diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md index 637e9f7cd951..a6f2ac1d22f7 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/CHANGELOG.md @@ -1,14 +1,762 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0-beta.1 (2026-07-06) -### Features Added +- Azure Resource Manager AzureArcData client library for Java. This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package api-version 2026-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.PageOfDataControllerResource` was removed + +#### `models.SqlServerInstanceListResult` was removed + +#### `models.OperationListResult` was removed + +#### `models.SqlManagedInstanceListResult` was removed + +#### `models.SqlManagedInstanceSku` was modified + +* `validate()` was removed + +#### `models.DataControllerUpdate` was modified + +* `validate()` was removed + +#### `models.K8SResourceRequirements` was modified + +* `validate()` was removed + +#### `models.BasicLoginInformation` was modified + +* `validate()` was removed + +#### `models.ArcSqlManagedInstanceLicenseType` was modified + +* `models.ArcSqlManagedInstanceLicenseType[] values()` -> `java.util.Collection values()` +* `toString()` was removed +* `valueOf(java.lang.String)` was removed + +#### `models.SqlManagedInstanceProperties` was modified + +* `validate()` was removed + +#### `models.SqlServerInstanceProperties` was modified + +* `withCollation(java.lang.String)` was removed +* `withStatus(models.ConnectionStatus)` was removed +* `withAzureDefenderStatusLastUpdated(java.time.OffsetDateTime)` was removed +* `withVCore(java.lang.String)` was removed +* `withContainerResourceId(java.lang.String)` was removed +* `withTcpDynamicPorts(java.lang.String)` was removed +* `withTcpStaticPorts(java.lang.String)` was removed +* `validate()` was removed +* `withPatchLevel(java.lang.String)` was removed +* `withCurrentVersion(java.lang.String)` was removed +* `withAzureDefenderStatus(models.DefenderStatus)` was removed +* `withLicenseType(models.ArcSqlServerLicenseType)` was removed +* `withProductId(java.lang.String)` was removed + +#### `models.OnPremiseProperty` was modified + +* `java.util.UUID id()` -> `java.lang.String id()` +* `validate()` was removed +* `withId(java.util.UUID)` was removed + +#### `models.SqlServerInstanceUpdate` was modified + +* `validate()` was removed + +#### `models.OperationDisplay` was modified + +* `OperationDisplay()` was changed to private access +* `withDescription(java.lang.String)` was removed +* `validate()` was removed +* `withOperation(java.lang.String)` was removed +* `withResource(java.lang.String)` was removed +* `withProvider(java.lang.String)` was removed + +#### `models.K8SScheduling` was modified + +* `validate()` was removed + +#### `models.SqlVersion` was modified + +* `SQL_SERVER_2019` was removed +* `SQL_SERVER_2016` was removed +* `SQL_SERVER_2017` was removed + +#### `models.K8SSchedulingOptions` was modified + +* `validate()` was removed + +#### `models.SqlManagedInstanceK8SSpec` was modified + +* `validate()` was removed + +#### `models.LogAnalyticsWorkspaceConfig` was modified + +* `validate()` was removed +* `java.util.UUID workspaceId()` -> `java.lang.String workspaceId()` +* `withWorkspaceId(java.util.UUID)` was removed + +#### `models.ExtendedLocation` was modified + +* `validate()` was removed + +#### `models.UploadWatermark` was modified + +* `validate()` was removed + +#### `models.UploadServicePrincipal` was modified + +* `java.util.UUID clientId()` -> `java.lang.String clientId()` +* `withClientId(java.util.UUID)` was removed +* `java.util.UUID tenantId()` -> `java.lang.String tenantId()` +* `validate()` was removed +* `withTenantId(java.util.UUID)` was removed + +#### `models.SqlManagedInstanceK8SRaw` was modified + +* `validate()` was removed + +#### `models.DataControllerProperties` was modified + +* `validate()` was removed + +#### `models.SqlManagedInstanceUpdate` was modified + +* `validate()` was removed + +### Features Added + +* `models.ArcSqlServerAvailabilityMode` was added + +* `models.SqlServerAvailabilityGroupResource` was added + +* `models.CostTypeValues` was added + +* `models.K8SSettings` was added + +* `models.FailoverGroupResource$Definition` was added + +* `models.SqlServerAvailabilityGroupResourceProperties` was added + +* `models.AlwaysOnRole` was added + +* `models.SqlServerInstanceJobsResponse` was added + +* `models.State` was added + +* `models.LicenseCategory` was added + +* `models.LastExecutionStatus` was added + +* `models.PostgresInstances` was added + +* `models.ActivationState` was added + +* `models.SqlServerDatabaseResource$UpdateStages` was added + +* `models.AzureManagedInstanceRole` was added + +* `models.SkuRecommendationResultsAzureSqlManagedInstance` was added + +* `models.HostIPAddressInformation` was added + +* `models.Schedule` was added + +* `models.DbFailover` was added + +* `models.SqlServerLicenseProperties` was added + +* `models.Version` was added + +* `models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory` was added + +* `models.SqlServerInstanceRunMigrationAssessmentResponse` was added + +* `models.SequencerAction` was added + +* `models.JobStatus` was added + +* `models.DBMEndpoint` was added + +* `models.SkuRecommendationResultsAzureSqlManagedInstanceTargetSku` was added + +* `models.CronTrigger` was added + +* `models.K8SSecurity` was added + +* `models.SqlServerInstanceJobStatus` was added + +* `models.SqlServerLicenseUpdateProperties` was added + +* `models.AggregationType` was added + +* `models.PostgresInstanceProperties` was added + +* `models.Authentication` was added + +* `models.K8SActiveDirectoryConnector` was added + +* `models.SqlServerAvailabilityGroupResourcePropertiesReplicas` was added + +* `models.SqlServerEsuLicenseUpdateProperties` was added + +* `models.SqlServerDatabaseUpdate` was added + +* `models.SqlServerAvailabilityGroupResource$Definition` was added + +* `models.ActiveDirectoryDomainControllers` was added + +* `models.SqlServerInstanceMigrationReadinessReportResponse` was added + +* `models.AvailabilityGroupInfo` was added + +* `models.RecoveryMode` was added + +* `models.SqlServerAvailabilityGroupResource$UpdateStages` was added + +* `models.SqlServerAvailabilityGroups` was added + +* `models.AutomatedBackupPreference` was added + +* `models.ClientConnection` was added + +* `models.InitiatedFrom` was added + +* `models.SkuRecommendationResultsMonthlyCostOptionItem` was added + +* `models.SqlServerAvailabilityGroupResourcePropertiesDatabases` was added + +* `models.SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory` was added + +* `models.SqlAvailabilityGroupDatabaseReplicaResourceProperties` was added + +* `models.ExecutionState` was added + +* `models.ActiveDirectoryInformation` was added + +* `models.Migration` was added + +* `models.Role` was added + +* `models.ActiveDirectoryConnectorDNSDetails` was added + +* `models.BackgroundJob` was added + +* `models.SqlServerAvailabilityGroupUpdate` was added + +* `models.ArcSqlServerAvailabilityGroupTypeFilter` was added + +* `models.SqlServerInstanceBpaColumnType` was added + +* `models.SqlServerLicense` was added + +* `models.FailureConditionLevel` was added + +* `models.ServerAssessmentsPropertiesItemsItem` was added + +* `models.K8STransparentDataEncryption` was added + +* `models.DistributedAvailabilityGroupCreateUpdateConfiguration` was added + +* `models.FailoverGroupPartnerSyncMode` was added + +* `models.SqlServerDatabaseResource$Update` was added + +* `models.ConnectionAuth` was added + +* `models.ClusterType` was added + +* `models.ProvisioningState` was added + +* `models.PostgresInstance$UpdateStages` was added + +* `models.SqlServerDatabaseResourcePropertiesBackupInformation` was added + +* `models.MigrationStatus` was added + +* `models.SqlServerInstanceBpaRequest` was added + +* `models.ActiveDirectoryConnectorResource$DefinitionStages` was added + +* `models.SqlServerInstanceManagedInstanceLinkAssessmentResponse` was added + +* `models.SqlServerInstanceBpaQueryType` was added + +* `models.SqlServerInstanceRunBestPracticesAssessmentResponse` was added + +* `models.Result` was added + +* `models.DatabaseCreateMode` was added + +* `models.MigrationAssessmentSettings` was added + +* `models.ActiveDirectoryConnectorSpec` was added + +* `models.DiscoverySource` was added + +* `models.MigrationAssessment` was added + +* `models.AvailabilityGroupConfigure` was added + +* `models.SqlServerInstanceTelemetryColumnType` was added + +* `models.SqlServerLicense$Definition` was added + +* `models.SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory` was added + +* `models.FailoverGroupProperties` was added + +* `models.SkuRecommendationResults` was added + +* `models.ImpactedObjectsInfo` was added + +* `models.ActiveDirectoryConnectorProperties` was added + +* `models.PostgresInstance$Definition` was added + +* `models.ActiveDirectoryDomainController` was added + +* `models.ActiveDirectoryConnectors` was added + +* `models.CommonSku` was added + +* `models.FailoverGroupSpec` was added + +* `models.IdentityType` was added + +* `models.SqlServerInstanceTargetRecommendationReport` was added + +* `models.SqlServerLicenseUpdate` was added + +* `models.ServiceType` was added + +* `models.TargetType` was added + +* `models.SqlServerDatabases` was added + +* `models.SqlServerEsuLicense` was added + +* `models.AdditionalMigrationJobAttributes` was added + +* `models.EncryptionAlgorithm` was added + +* `models.SqlServerInstanceTelemetryColumn` was added + +* `models.AvailabilityGroupRetrievalFilters` was added + +* `models.InstanceFailoverGroupRole` was added + +* `models.SqlServerDatabaseResource` was added + +* `models.SqlServerEsuLicense$DefinitionStages` was added + +* `models.PostgresInstanceUpdate` was added + +* `models.FailoverCluster` was added + +* `models.ActiveDirectoryConnectorStatus` was added + +* `models.SqlServerEsuLicense$Definition` was added + +* `models.BillingPlan` was added + +* `models.RecommendationStatus` was added + +* `models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem` was added + +* `models.PostgresInstance$Update` was added + +* `models.SqlServerLicenses` was added + +* `models.SqlServerDatabaseResourceProperties` was added + +* `models.SqlServerEsuLicenseProperties` was added + +* `models.FailoverGroups` was added + +* `models.KeytabInformation` was added + +* `models.SkuRecommendationSummaryTargetSku` was added + +* `models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize` was added + +* `models.SqlServerInstanceJobsStatusRequest` was added + +* `models.SqlServerInstanceJob` was added + +* `models.SqlServerInstanceManagedInstanceLinkAssessment` was added + +* `models.AssessmentStatus` was added + +* `models.ActiveDirectoryConnectorResource` was added + +* `models.PostgresInstance` was added + +* `models.SqlServerLicense$DefinitionStages` was added + +* `models.DiskSizes` was added + +* `models.HostType` was added + +* `models.Databases` was added + +* `models.PostgresInstance$DefinitionStages` was added + +* `models.SqlServerInstanceJobsStatusResponse` was added + +* `models.ActiveDirectoryConnectorDomainDetails` was added + +* `models.DatabaseState` was added + +* `models.SqlServerEsuLicense$Update` was added + +* `models.DataBaseMigration` was added + +* `models.SequencerState` was added + +* `models.ScopeType` was added + +* `models.SqlServerInstanceRunMigrationReadinessAssessmentResponse` was added + +* `models.DataBaseMigrationAssessment` was added + +* `models.MiLinkAssessmentCategory` was added + +* `models.SkuRecommendationSummary` was added + +* `models.SqlServerInstanceUpdateProperties` was added + +* `models.SqlServerDatabaseResource$Definition` was added + +* `models.SqlAvailabilityGroupStaticIPListenerProperties` was added + +* `models.ServerAssessmentsItem` was added + +* `models.DifferentialBackupHours` was added + +* `models.SqlServerInstanceTargetRecommendationReportSection` was added + +* `models.SqlServerLicense$UpdateStages` was added + +* `models.DatabaseMigrationJobsItem` was added + +* `models.K8SActiveDirectory` was added + +* `models.PostgresInstanceSku` was added + +* `models.DtcSupport` was added + +* `models.SqlServerDatabaseResource$DefinitionStages` was added + +* `models.SqlServerInstanceTargetRecommendationReportsRequest` was added + +* `models.MigrationMode` was added + +* `models.EntraAuthentication` was added + +* `models.AvailabilityGroupState` was added + +* `models.PostgresInstanceSkuTier` was added + +* `models.SqlServerEsuLicenses` was added + +* `models.SqlServerInstanceBpaColumn` was added + +* `models.SqlServerInstanceTargetRecommendationReportsResponse` was added + +* `models.MiLinkCreateUpdateConfiguration` was added + +* `models.AvailabilityGroupCreateUpdateConfiguration` was added + +* `models.SkuRecommendationResultsAzureSqlDatabaseTargetSku` was added + +* `models.AvailabilityGroupCreateUpdateReplicaConfiguration` was added + +* `models.SkuRecommendationResultsAzureSqlDatabase` was added + +* `models.SqlServerEsuLicenseUpdate` was added + +* `models.SqlServerLicense$Update` was added + +* `models.SecondaryAllowConnections` was added + +* `models.FailoverGroupResource$DefinitionStages` was added + +* `models.SqlServerInstanceTargetRecommendationReportSectionType` was added + +* `models.SkuRecommendationSummaryTargetSkuCategory` was added + +* `models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration` was added + +* `models.SqlServerEsuLicense$UpdateStages` was added + +* `models.Mode` was added + +* `models.ImpactedObjectsSuitabilitySummary` was added + +* `models.SqlServerInstanceTelemetryRequest` was added + +* `models.Monitoring` was added + +* `models.TargetReadiness` was added + +* `models.CostOptionSelectedValues` was added + +* `models.SkuRecommendationResultsAzureSqlVirtualMachine` was added + +* `models.SqlServerAvailabilityGroupResource$Update` was added + +* `models.FailoverMiLinkResourceId` was added + +* `models.SqlServerInstanceJobsRequest` was added + +* `models.ResourceUpdateMode` was added + +* `models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSku` was added + +* `models.SqlServerDatabaseResourcePropertiesDatabaseOptions` was added + +* `models.DatabaseAssessmentsItem` was added + +* `models.SqlAvailabilityGroupReplicaResourceProperties` was added + +* `models.BackupPolicy` was added + +* `models.FailoverGroupResource` was added + +* `models.ManagedInstanceLinkCreateUpdateConfiguration` was added + +* `models.SqlServerInstanceBpaReportType` was added + +* `models.ActiveDirectoryConnectorResource$Definition` was added + +* `models.PrimaryAllowConnections` was added + +* `models.ReplicationPartnerType` was added + +* `models.SqlServerInstanceRunTargetRecommendationJobResponse` was added + +* `models.ArcSqlServerFailoverMode` was added + +* `models.SqlServerInstanceManagedInstanceLinkAssessmentRequest` was added + +* `models.K8SNetworkSettings` was added + +* `models.SeedingMode` was added + +* `models.SqlServerAvailabilityGroupResource$DefinitionStages` was added + +* `models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration` was added + +* `models.AccountProvisioningMode` was added + +* `models.SkuRecommendationResultsMonthlyCost` was added + +* `models.BestPracticesAssessment` was added + +* `models.SqlServerInstanceRunTargetRecommendationJobRequest` was added + +#### `models.DataControllerResource$Update` was modified + +* `withProperties(models.DataControllerProperties)` was added + +#### `models.DataControllerUpdate` was modified + +* `properties()` was added +* `withProperties(models.DataControllerProperties)` was added + +#### `models.SqlServerInstances` was modified + +* `getJobsStatus(java.lang.String,java.lang.String)` was added +* `getMigrationReadinessReport(java.lang.String,java.lang.String)` was added +* `runBestPracticesAssessmentWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `getAllAvailabilityGroups(java.lang.String,java.lang.String,models.AvailabilityGroupRetrievalFilters,com.azure.core.util.Context)` was added +* `runTargetRecommendationJob(java.lang.String,java.lang.String)` was added +* `runManagedInstanceLinkAssessment(java.lang.String,java.lang.String,models.SqlServerInstanceManagedInstanceLinkAssessmentRequest,com.azure.core.util.Context)` was added +* `getBestPracticesAssessment(java.lang.String,java.lang.String,models.SqlServerInstanceBpaRequest)` was added +* `postUpgradeWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `getMigrationReadinessReport(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `getJobsStatusWithResponse(java.lang.String,java.lang.String,models.SqlServerInstanceJobsStatusRequest,com.azure.core.util.Context)` was added +* `getTargetRecommendationReports(java.lang.String,java.lang.String,models.SqlServerInstanceTargetRecommendationReportsRequest,com.azure.core.util.Context)` was added +* `preUpgrade(java.lang.String,java.lang.String)` was added +* `getJobs(java.lang.String,java.lang.String,models.SqlServerInstanceJobsRequest,com.azure.core.util.Context)` was added +* `getTargetRecommendationReports(java.lang.String,java.lang.String)` was added +* `runBestPracticeAssessment(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `getTelemetry(java.lang.String,java.lang.String,models.SqlServerInstanceTelemetryRequest)` was added +* `preUpgradeWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `runManagedInstanceLinkAssessment(java.lang.String,java.lang.String,models.SqlServerInstanceManagedInstanceLinkAssessmentRequest)` was added +* `runMigrationReadinessAssessment(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `runMigrationAssessment(java.lang.String,java.lang.String)` was added +* `runTargetRecommendationJob(java.lang.String,java.lang.String,models.SqlServerInstanceRunTargetRecommendationJobRequest,com.azure.core.util.Context)` was added +* `getAllAvailabilityGroups(java.lang.String,java.lang.String)` was added +* `getTelemetry(java.lang.String,java.lang.String,models.SqlServerInstanceTelemetryRequest,com.azure.core.util.Context)` was added +* `runMigrationReadinessAssessment(java.lang.String,java.lang.String)` was added +* `runBestPracticeAssessment(java.lang.String,java.lang.String)` was added +* `getBestPracticesAssessment(java.lang.String,java.lang.String,models.SqlServerInstanceBpaRequest,com.azure.core.util.Context)` was added +* `getJobs(java.lang.String,java.lang.String)` was added +* `runBestPracticesAssessment(java.lang.String,java.lang.String)` was added +* `postUpgrade(java.lang.String,java.lang.String)` was added +* `runMigrationAssessmentWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added + +#### `models.ArcSqlManagedInstanceLicenseType` was modified + +* `ArcSqlManagedInstanceLicenseType()` was added +* `DISASTER_RECOVERY` was added + +#### `models.SqlManagedInstanceProperties` was modified + +* `activeDirectoryInformation()` was added +* `withActiveDirectoryInformation(models.ActiveDirectoryInformation)` was added + +#### `models.SqlServerInstanceProperties` was modified + +* `traceFlags()` was added +* `maxServerMemoryMB()` was added +* `withFailoverCluster(models.FailoverCluster)` was added +* `clientConnection()` was added +* `withServiceType(models.ServiceType)` was added +* `migration()` was added +* `authentication()` was added +* `lastUsageUploadTime()` was added +* `cores()` was added +* `vmId()` was added +* `isHadrEnabled()` was added +* `withBackupPolicy(models.BackupPolicy)` was added +* `monitoring()` was added +* `lastInventoryUploadTime()` was added +* `discoverySource()` was added +* `withClientConnection(models.ClientConnection)` was added +* `failoverCluster()` was added +* `withUpgradeLockedUntil(java.time.OffsetDateTime)` was added +* `withDiscoverySource(models.DiscoverySource)` was added +* `withAuthentication(models.Authentication)` was added +* `isDigiCertPkiCertTrustConfigured()` was added +* `withBestPracticesAssessment(models.BestPracticesAssessment)` was added +* `hostType()` was added +* `databaseMirroringEndpoint()` was added +* `alwaysOnRole()` was added +* `isMicrosoftPkiCertTrustConfigured()` was added +* `withDatabaseMirroringEndpoint(models.DBMEndpoint)` was added +* `upgradeLockedUntil()` was added +* `withMonitoring(models.Monitoring)` was added +* `bestPracticesAssessment()` was added +* `withHostType(models.HostType)` was added +* `withCores(java.lang.String)` was added +* `withMigration(models.Migration)` was added +* `dbMasterKeyExists()` was added +* `serviceType()` was added +* `backupPolicy()` was added + +#### `models.OnPremiseProperty` was modified + +* `withId(java.lang.String)` was added + +#### `models.SqlServerInstanceUpdate` was modified + +* `withProperties(models.SqlServerInstanceUpdateProperties)` was added +* `properties()` was added + +#### `models.ConnectionStatus` was modified + +* `REGISTERED` was added +* `DISCOVERED` was added + +#### `models.SqlVersion` was modified + +* `SQLSERVER2022` was added +* `SQLSERVER2012` was added +* `SQLSERVER2014` was added +* `SQLSERVER2025` was added +* `UNKNOWN` was added +* `SQLSERVER2016` was added +* `SQLSERVER2017` was added +* `SQLSERVER2019` was added + +#### `models.SqlServerInstance$Update` was modified + +* `withProperties(models.SqlServerInstanceUpdateProperties)` was added + +#### `models.ArcSqlServerLicenseType` was modified + +* `SERVER_CAL` was added +* `LICENSE_ONLY` was added +* `FABRIC_CAPACITY` was added +* `PAYG` was added + +#### `models.SqlManagedInstanceK8SSpec` was modified + +* `withSettings(models.K8SSettings)` was added +* `settings()` was added +* `withSecurity(models.K8SSecurity)` was added +* `security()` was added + +#### `AzureArcDataManager` was modified + +* `sqlServerLicenses()` was added +* `sqlServerDatabases()` was added +* `sqlServerAvailabilityGroups()` was added +* `failoverGroups()` was added +* `postgresInstances()` was added +* `sqlServerEsuLicenses()` was added +* `activeDirectoryConnectors()` was added + +#### `models.LogAnalyticsWorkspaceConfig` was modified + +* `withWorkspaceId(java.lang.String)` was added + +#### `models.UploadServicePrincipal` was modified + +* `withClientId(java.lang.String)` was added +* `withTenantId(java.lang.String)` was added + +#### `models.EditionType` was modified + +* `BUSINESS_INTELLIGENCE` was added +* `STANDARD_DEVELOPER` was added +* `UNKNOWN` was added + +#### `models.DataControllerProperties` was modified + +* `logsDashboardCredential()` was added +* `metricsDashboardCredential()` was added +* `withMetricsDashboardCredential(models.BasicLoginInformation)` was added +* `withLogsDashboardCredential(models.BasicLoginInformation)` was added + +#### `models.SqlServerInstance` was modified -### Other Changes +* `getAllAvailabilityGroups(models.AvailabilityGroupRetrievalFilters,com.azure.core.util.Context)` was added +* `getJobs(models.SqlServerInstanceJobsRequest,com.azure.core.util.Context)` was added +* `preUpgrade()` was added +* `runMigrationAssessment()` was added +* `runBestPracticesAssessmentWithResponse(com.azure.core.util.Context)` was added +* `runTargetRecommendationJob(models.SqlServerInstanceRunTargetRecommendationJobRequest,com.azure.core.util.Context)` was added +* `runBestPracticeAssessment(com.azure.core.util.Context)` was added +* `getAllAvailabilityGroups()` was added +* `getJobs()` was added +* `getJobsStatus()` was added +* `getTargetRecommendationReports(models.SqlServerInstanceTargetRecommendationReportsRequest,com.azure.core.util.Context)` was added +* `getTelemetry(models.SqlServerInstanceTelemetryRequest,com.azure.core.util.Context)` was added +* `runManagedInstanceLinkAssessment(models.SqlServerInstanceManagedInstanceLinkAssessmentRequest,com.azure.core.util.Context)` was added +* `runTargetRecommendationJob()` was added +* `getMigrationReadinessReport()` was added +* `getTelemetry(models.SqlServerInstanceTelemetryRequest)` was added +* `getBestPracticesAssessment(models.SqlServerInstanceBpaRequest,com.azure.core.util.Context)` was added +* `getJobsStatusWithResponse(models.SqlServerInstanceJobsStatusRequest,com.azure.core.util.Context)` was added +* `runBestPracticeAssessment()` was added +* `getBestPracticesAssessment(models.SqlServerInstanceBpaRequest)` was added +* `getMigrationReadinessReport(com.azure.core.util.Context)` was added +* `getTargetRecommendationReports()` was added +* `runMigrationReadinessAssessment()` was added +* `runManagedInstanceLinkAssessment(models.SqlServerInstanceManagedInstanceLinkAssessmentRequest)` was added +* `postUpgradeWithResponse(com.azure.core.util.Context)` was added +* `postUpgrade()` was added +* `preUpgradeWithResponse(com.azure.core.util.Context)` was added +* `runBestPracticesAssessment()` was added +* `runMigrationReadinessAssessment(com.azure.core.util.Context)` was added +* `runMigrationAssessmentWithResponse(com.azure.core.util.Context)` was added ## 1.0.0 (2025-01-02) diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md index 6e7fb13ca5e6..b235236cabd6 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/README.md @@ -2,7 +2,7 @@ Azure Resource Manager AzureArcData client library for Java. -This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-2021-08-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for AzureArcData Management SDK. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package api-version 2026-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ AzureArcDataManager manager = AzureArcDataManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md index b40126fa99bd..152018d3ed12 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/SAMPLE.md @@ -1,6 +1,13 @@ # Code snippets and samples +## ActiveDirectoryConnectors + +- [Create](#activedirectoryconnectors_create) +- [Delete](#activedirectoryconnectors_delete) +- [Get](#activedirectoryconnectors_get) +- [List](#activedirectoryconnectors_list) + ## DataControllers - [Delete](#datacontrollers_delete) @@ -10,10 +17,26 @@ - [PatchDataController](#datacontrollers_patchdatacontroller) - [PutDataController](#datacontrollers_putdatacontroller) +## FailoverGroups + +- [Create](#failovergroups_create) +- [Delete](#failovergroups_delete) +- [Get](#failovergroups_get) +- [List](#failovergroups_list) + ## Operations - [List](#operations_list) +## PostgresInstances + +- [Create](#postgresinstances_create) +- [Delete](#postgresinstances_delete) +- [GetByResourceGroup](#postgresinstances_getbyresourcegroup) +- [List](#postgresinstances_list) +- [ListByResourceGroup](#postgresinstances_listbyresourcegroup) +- [Update](#postgresinstances_update) + ## SqlManagedInstances - [Create](#sqlmanagedinstances_create) @@ -23,14 +46,188 @@ - [ListByResourceGroup](#sqlmanagedinstances_listbyresourcegroup) - [Update](#sqlmanagedinstances_update) +## SqlServerAvailabilityGroups + +- [AddDatabases](#sqlserveravailabilitygroups_adddatabases) +- [Create](#sqlserveravailabilitygroups_create) +- [CreateAvailabilityGroup](#sqlserveravailabilitygroups_createavailabilitygroup) +- [CreateDistributedAvailabilityGroup](#sqlserveravailabilitygroups_createdistributedavailabilitygroup) +- [CreateManagedInstanceLink](#sqlserveravailabilitygroups_createmanagedinstancelink) +- [Delete](#sqlserveravailabilitygroups_delete) +- [DeleteMiLink](#sqlserveravailabilitygroups_deletemilink) +- [DetailView](#sqlserveravailabilitygroups_detailview) +- [Failover](#sqlserveravailabilitygroups_failover) +- [FailoverMiLink](#sqlserveravailabilitygroups_failovermilink) +- [ForceFailoverAllowDataLoss](#sqlserveravailabilitygroups_forcefailoverallowdataloss) +- [Get](#sqlserveravailabilitygroups_get) +- [List](#sqlserveravailabilitygroups_list) +- [RemoveDatabases](#sqlserveravailabilitygroups_removedatabases) +- [Update](#sqlserveravailabilitygroups_update) + +## SqlServerDatabases + +- [Create](#sqlserverdatabases_create) +- [Delete](#sqlserverdatabases_delete) +- [Get](#sqlserverdatabases_get) +- [List](#sqlserverdatabases_list) +- [Update](#sqlserverdatabases_update) + +## SqlServerEsuLicenses + +- [Create](#sqlserveresulicenses_create) +- [Delete](#sqlserveresulicenses_delete) +- [GetByResourceGroup](#sqlserveresulicenses_getbyresourcegroup) +- [List](#sqlserveresulicenses_list) +- [ListByResourceGroup](#sqlserveresulicenses_listbyresourcegroup) +- [Update](#sqlserveresulicenses_update) + ## SqlServerInstances - [Create](#sqlserverinstances_create) - [Delete](#sqlserverinstances_delete) +- [GetAllAvailabilityGroups](#sqlserverinstances_getallavailabilitygroups) +- [GetBestPracticesAssessment](#sqlserverinstances_getbestpracticesassessment) - [GetByResourceGroup](#sqlserverinstances_getbyresourcegroup) +- [GetJobs](#sqlserverinstances_getjobs) +- [GetJobsStatus](#sqlserverinstances_getjobsstatus) +- [GetMigrationReadinessReport](#sqlserverinstances_getmigrationreadinessreport) +- [GetTargetRecommendationReports](#sqlserverinstances_gettargetrecommendationreports) +- [GetTelemetry](#sqlserverinstances_gettelemetry) - [List](#sqlserverinstances_list) - [ListByResourceGroup](#sqlserverinstances_listbyresourcegroup) +- [PostUpgrade](#sqlserverinstances_postupgrade) +- [PreUpgrade](#sqlserverinstances_preupgrade) +- [RunBestPracticeAssessment](#sqlserverinstances_runbestpracticeassessment) +- [RunBestPracticesAssessment](#sqlserverinstances_runbestpracticesassessment) +- [RunManagedInstanceLinkAssessment](#sqlserverinstances_runmanagedinstancelinkassessment) +- [RunMigrationAssessment](#sqlserverinstances_runmigrationassessment) +- [RunMigrationReadinessAssessment](#sqlserverinstances_runmigrationreadinessassessment) +- [RunTargetRecommendationJob](#sqlserverinstances_runtargetrecommendationjob) - [Update](#sqlserverinstances_update) + +## SqlServerLicenses + +- [Create](#sqlserverlicenses_create) +- [Delete](#sqlserverlicenses_delete) +- [GetByResourceGroup](#sqlserverlicenses_getbyresourcegroup) +- [List](#sqlserverlicenses_list) +- [ListByResourceGroup](#sqlserverlicenses_listbyresourcegroup) +- [Update](#sqlserverlicenses_update) +### ActiveDirectoryConnectors_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDNSDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorSpec; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; + +/** + * Samples for ActiveDirectoryConnectors Create. + */ +public final class ActiveDirectoryConnectorsCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateActiveDirectoryConnector.json + */ + /** + * Sample code: Create or update an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAnActiveDirectoryConnectorInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .define("testADConnector") + .withExistingDataController("testrg", "testdataController") + .withProperties(new ActiveDirectoryConnectorProperties().withSpec(new ActiveDirectoryConnectorSpec() + .withActiveDirectory(new ActiveDirectoryConnectorDomainDetails().withRealm("CONTOSO.LOCAL") + .withServiceAccountProvisioning(AccountProvisioningMode.MANUAL) + .withDomainControllers(new ActiveDirectoryDomainControllers() + .withPrimaryDomainController( + new ActiveDirectoryDomainController().withHostname("dc1.contoso.local")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("dc2.contoso.local"), + new ActiveDirectoryDomainController().withHostname("dc3.contoso.local"))))) + .withDns(new ActiveDirectoryConnectorDNSDetails() + .withNameserverIPAddresses(Arrays.asList("11.11.111.111", "22.22.222.222")) + .withReplicas(1L) + .withPreferK8SDnsForPtrLookups(false)))) + .create(); + } +} +``` + +### ActiveDirectoryConnectors_Delete + +```java +/** + * Samples for ActiveDirectoryConnectors Delete. + */ +public final class ActiveDirectoryConnectorsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteActiveDirectoryConnector.json + */ + /** + * Sample code: Deletes an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAnActiveDirectoryConnectorInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .delete("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} +``` + +### ActiveDirectoryConnectors_Get + +```java +/** + * Samples for ActiveDirectoryConnectors Get. + */ +public final class ActiveDirectoryConnectorsGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetActiveDirectoryConnector.json + */ + /** + * Sample code: Retrieves an Active Directory connector resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnActiveDirectoryConnectorResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .getWithResponse("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} +``` + +### ActiveDirectoryConnectors_List + +```java +/** + * Samples for ActiveDirectoryConnectors List. + */ +public final class ActiveDirectoryConnectorsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByDataControllerActiveDirectoryConnector.json + */ + /** + * Sample code: Gets all Active Directory connectors associated with a data controller. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllActiveDirectoryConnectorsAssociatedWithADataController( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors().list("testrg", "testdataController", com.azure.core.util.Context.NONE); + } +} +``` + ### DataControllers_Delete ```java @@ -39,9 +236,7 @@ */ public final class DataControllersDeleteSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * DeleteDataController.json + * x-ms-original-file: 2026-03-01-preview/DeleteDataController.json */ /** * Sample code: Delete a dataController. @@ -62,9 +257,7 @@ public final class DataControllersDeleteSamples { */ public final class DataControllersGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetDataController. - * json + * x-ms-original-file: 2026-03-01-preview/GetDataController.json */ /** * Sample code: Get a data controller. @@ -86,9 +279,7 @@ public final class DataControllersGetByResourceGroupSamples { */ public final class DataControllersListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListSubscriptionDataController.json + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. @@ -110,9 +301,7 @@ public final class DataControllersListSamples { */ public final class DataControllersListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListByResourceGroupDataController.json + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. @@ -138,9 +327,7 @@ import java.util.Map; */ public final class DataControllersPatchDataControllerSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * UpdateDataController.json + * x-ms-original-file: 2026-03-01-preview/UpdateDataController.json */ /** * Sample code: Updates a dataController tags. @@ -183,16 +370,13 @@ import com.azure.resourcemanager.azurearcdata.models.UploadWatermark; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; -import java.util.UUID; /** * Samples for DataControllers PutDataController. */ public final class DataControllersPutDataControllerSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * CreateOrUpdateDataController.json + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. @@ -206,21 +390,24 @@ public final class DataControllersPutDataControllerSamples { .withRegion("northeurope") .withExistingResourceGroup("testrg") .withProperties(new DataControllerProperties().withInfrastructure(Infrastructure.ONPREMISES) - .withOnPremiseProperty( - new OnPremiseProperty().withId(UUID.fromString("12345678-1234-1234-ab12-1a2b3c4d5e6f")) - .withPublicSigningKey("fakeTokenPlaceholder")) + .withOnPremiseProperty(new OnPremiseProperty().withId("12345678-1234-1234-ab12-1a2b3c4d5e6f") + .withPublicSigningKey("fakeTokenPlaceholder")) .withUploadWatermark( new UploadWatermark().withMetrics(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) .withLogs(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) .withUsages(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z"))) .withBasicLoginInformation( new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) - .withLogAnalyticsWorkspaceConfig(new LogAnalyticsWorkspaceConfig() - .withWorkspaceId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withPrimaryKey("fakeTokenPlaceholder")) + .withMetricsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogAnalyticsWorkspaceConfig( + new LogAnalyticsWorkspaceConfig().withWorkspaceId("00000000-1111-2222-3333-444444444444") + .withPrimaryKey("fakeTokenPlaceholder")) .withUploadServicePrincipal( - new UploadServicePrincipal().withClientId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withTenantId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + new UploadServicePrincipal().withClientId("00000000-1111-2222-3333-444444444444") + .withTenantId("00000000-1111-2222-3333-444444444444") .withAuthority("https://login.microsoftonline.com/") .withClientSecret("fakeTokenPlaceholder")) .withClusterId( @@ -248,6 +435,125 @@ public final class DataControllersPutDataControllerSamples { } ``` +### FailoverGroups_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FailoverGroups Create. + */ +public final class FailoverGroupsCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateFailoverGroup.json + */ + /** + * Sample code: Create or update a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createOrUpdateAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .define("testFailoverGroupName") + .withExistingSqlManagedInstance("testrg", "testSqlManagedInstance") + .withProperties(new FailoverGroupProperties().withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/partnerMI") + .withSpec(new FailoverGroupSpec().withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.PRIMARY) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### FailoverGroups_Delete + +```java +/** + * Samples for FailoverGroups Delete. + */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteFailoverGroup.json + */ + /** + * Sample code: Deletes a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .delete("testrg", "testSqlManagedInstance", "testFailoverGroupName", com.azure.core.util.Context.NONE); + } +} +``` + +### FailoverGroups_Get + +```java +/** + * Samples for FailoverGroups Get. + */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetFailoverGroup.json + */ + /** + * Sample code: Retrieves a failover group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAFailoverGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .getWithResponse("testrg", "testSqlManagedInstance", "testFailoverGroupName", + com.azure.core.util.Context.NONE); + } +} +``` + +### FailoverGroups_List + +```java +/** + * Samples for FailoverGroups List. + */ +public final class FailoverGroupsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListBySqlManagedInstanceFailoverGroup.json + */ + /** + * Sample code: Gets all failover groups associated with a sql managed instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllFailoverGroupsAssociatedWithASqlManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups().list("testrg", "testSqlManagedInstance", com.azure.core.util.Context.NONE); + } +} +``` + ### Operations_List ```java @@ -256,8 +562,7 @@ public final class DataControllersPutDataControllerSamples { */ public final class OperationsListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListOperation.json + * x-ms-original-file: 2026-03-01-preview/ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. @@ -271,214 +576,166 @@ public final class OperationsListSamples { } ``` -### SqlManagedInstances_Create +### PostgresInstances_Create ```java -import com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; -import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier; -import java.util.HashMap; -import java.util.Map; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSkuTier; +import java.io.IOException; /** - * Samples for SqlManagedInstances Create. + * Samples for PostgresInstances Create. */ -public final class SqlManagedInstancesCreateSamples { +public final class PostgresInstancesCreateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * CreateOrUpdateSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdatePostgresInstance.json */ /** - * Sample code: Create or update a SQL Managed Instance. + * Sample code: Create or update a Postgres Instance. * * @param manager Entry point to AzureArcDataManager. */ - public static void - createOrUpdateASQLManagedInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances() - .define("testsqlManagedInstance") - .withRegion("northeurope") + public static void createOrUpdateAPostgresInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) throws IOException { + manager.postgresInstances() + .define("testpostgresInstance") + .withRegion("eastus") .withExistingResourceGroup("testrg") - .withProperties( - new SqlManagedInstanceProperties().withAdmin("Admin user") - .withStartTime("Instance start time") - .withEndTime("Instance end time") - .withK8SRaw( - new SqlManagedInstanceK8SRaw() - .withSpec(new SqlManagedInstanceK8SSpec() - .withScheduling( - new K8SScheduling() - .withDefaultProperty( - new K8SSchedulingOptions() - .withResources(new K8SResourceRequirements() - .withRequests(mapOf("additionalProperty", "additionalValue", "cpu", - "1", "memory", "8Gi")) - .withLimits(mapOf("additionalProperty", "additionalValue", "cpu", - "1", "memory", "8Gi")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withReplicas(1) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf("additionalProperty", 1234))) - .withBasicLoginInformation( - new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) - .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) - .withClusterId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") - .withExtensionId( - "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) - .withTags(mapOf("mytag", "myval")) + .withProperties(new PostgresInstanceProperties().withDataControllerId("dataControllerId") + .withAdmin("admin") + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withK8SRaw(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"apiVersion\":\"apiVersion\",\"kind\":\"postgresql-12\",\"metadata\":{\"name\":\"pg1\",\"creationTimestamp\":\"2020-08-25T14:55:10Z\",\"generation\":1,\"namespace\":\"test\",\"resourceVersion\":\"527780\",\"selfLink\":\"/apis/arcdata.microsoft.com/v1alpha1/namespaces/test/postgresql-12s/pg1\",\"uid\":\"1111aaaa-ffff-ffff-ffff-99999aaaaaaa\"},\"spec\":{\"backups\":{\"deltaMinutes\":3,\"fullMinutes\":10,\"tiers\":[{\"retention\":{\"maximums\":[\"6\",\"512MB\"],\"minimums\":[\"3\"]},\"storage\":{\"volumeSize\":\"1Gi\"}}]},\"engine\":{\"extensions\":[{\"name\":\"citus\"}]},\"scale\":{\"shards\":3},\"scheduling\":{\"default\":{\"resources\":{\"requests\":{\"memory\":\"256Mi\"}}}},\"service\":{\"type\":\"NodePort\"},\"storage\":{\"data\":{\"className\":\"local-storage\",\"size\":\"5Gi\"},\"logs\":{\"className\":\"local-storage\",\"size\":\"5Gi\"}}},\"status\":{\"externalEndpoint\":null,\"readyPods\":\"4/4\",\"state\":\"Ready\"}}", + Object.class, SerializerEncoding.JSON))) .withExtendedLocation(new ExtendedLocation().withName( "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) - .withSku(new SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE).withDev(true)) + .withSku(new PostgresInstanceSku().withName("default") + .withDev(true) + .withTier(PostgresInstanceSkuTier.HYPERSCALE)) .create(); } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } } ``` -### SqlManagedInstances_Delete +### PostgresInstances_Delete ```java /** - * Samples for SqlManagedInstances Delete. + * Samples for PostgresInstances Delete. */ -public final class SqlManagedInstancesDeleteSamples { +public final class PostgresInstancesDeleteSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * DeleteSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/DeletePostgresInstance.json */ /** - * Sample code: Delete a SQL Instance. + * Sample code: Deletes a PostgresInstances. * * @param manager Entry point to AzureArcDataManager. */ - public static void deleteASQLInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances().delete("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + public static void deletesAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().delete("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_GetByResourceGroup +### PostgresInstances_GetByResourceGroup ```java /** - * Samples for SqlManagedInstances GetByResourceGroup. + * Samples for PostgresInstances GetByResourceGroup. */ -public final class SqlManagedInstancesGetByResourceGroupSamples { +public final class PostgresInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * GetSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/GetPostgresInstance.json */ /** - * Sample code: Updates a SQL Instance tags. + * Sample code: Gets a postgres Instances. * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASQLInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances() - .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + public static void getsAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstances", com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_List +### PostgresInstances_List ```java /** - * Samples for SqlManagedInstances List. + * Samples for PostgresInstances List. */ -public final class SqlManagedInstancesListSamples { +public final class PostgresInstancesListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListSubscriptionSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionPostgresInstance.json */ /** - * Sample code: Gets all SQL Instance in a subscription. + * Sample code: Gets all Postgres Instance in a subscription. * * @param manager Entry point to AzureArcDataManager. */ public static void - getsAllSQLInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances().list(com.azure.core.util.Context.NONE); + getsAllPostgresInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().list(com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_ListByResourceGroup +### PostgresInstances_ListByResourceGroup ```java /** - * Samples for SqlManagedInstances ListByResourceGroup. + * Samples for PostgresInstances ListByResourceGroup. */ -public final class SqlManagedInstancesListByResourceGroupSamples { +public final class PostgresInstancesListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListByResourceGroupSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupPostgresInstance.json */ /** - * Sample code: Gets all SQL Instance in a resource group. + * Sample code: Gets all postgres Instances in a resource group. * * @param manager Entry point to AzureArcDataManager. */ public static void - getsAllSQLInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlManagedInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + getsAllPostgresInstancesInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } ``` -### SqlManagedInstances_Update +### PostgresInstances_Update ```java -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstance; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; import java.util.HashMap; import java.util.Map; /** - * Samples for SqlManagedInstances Update. + * Samples for PostgresInstances Update. */ -public final class SqlManagedInstancesUpdateSamples { +public final class PostgresInstancesUpdateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * UpdateSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/UpdatePostgresInstance.json */ /** - * Sample code: Updates a sql Instance tags. + * Sample code: Updates a postgres Instances tags. * * @param manager Entry point to AzureArcDataManager. */ - public static void updatesASqlInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlManagedInstance resource = manager.sqlManagedInstances() - .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) + public static void + updatesAPostgresInstancesTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + PostgresInstance resource = manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE) .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } @@ -497,27 +754,1826 @@ public final class SqlManagedInstancesUpdateSamples { } ``` -### SqlServerInstances_Create +### SqlManagedInstances_Create ```java -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryInformation; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType; +import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectory; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectoryConnector; +import com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings; +import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; +import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; +import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; +import com.azure.resourcemanager.azurearcdata.models.K8SSecurity; +import com.azure.resourcemanager.azurearcdata.models.K8SSettings; +import com.azure.resourcemanager.azurearcdata.models.K8STransparentDataEncryption; +import com.azure.resourcemanager.azurearcdata.models.KeytabInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlManagedInstances Create. + */ +public final class SqlManagedInstancesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlManagedInstance.json + */ + /** + * Sample code: Create or update a SQL Managed Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createOrUpdateASQLManagedInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances() + .define("testsqlManagedInstance") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties( + new SqlManagedInstanceProperties().withAdmin("Admin user") + .withStartTime("Instance start time") + .withEndTime("Instance end time") + .withK8SRaw( + new SqlManagedInstanceK8SRaw() + .withSpec(new SqlManagedInstanceK8SSpec() + .withScheduling( + new K8SScheduling() + .withDefaultProperty( + new K8SSchedulingOptions() + .withResources(new K8SResourceRequirements() + .withRequests(mapOf("additionalProperty", "additionalValue", "cpu", + "1", "memory", "8Gi")) + .withLimits(mapOf("additionalProperty", "additionalValue", "cpu", + "1", "memory", "8Gi")) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withReplicas(1) + .withSecurity(new K8SSecurity() + .withAdminLoginSecret("fakeTokenPlaceholder") + .withServiceCertificateSecret("fakeTokenPlaceholder") + .withActiveDirectory(new K8SActiveDirectory() + .withConnector(new K8SActiveDirectoryConnector().withName("Name of connector") + .withNamespace("Namespace of connector")) + .withAccountName("Account name") + .withKeytabSecret("fakeTokenPlaceholder") + .withEncryptionTypes( + Arrays.asList("Encryption type item1, Encryption type item2,..."))) + .withTransparentDataEncryption( + new K8STransparentDataEncryption().withMode("SystemManaged")) + .withAdditionalProperties(mapOf())) + .withSettings( + new K8SSettings().withNetwork(new K8SNetworkSettings().withForceencryption(0) + .withTlsciphers( + "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384") + .withTlsprotocols("1.2")).withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf("additionalProperty", 1234))) + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withActiveDirectoryInformation(new ActiveDirectoryInformation() + .withKeytabInformation(new KeytabInformation().withKeytab("fakeTokenPlaceholder"))) + .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) + .withClusterId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") + .withExtensionId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension")) + .withTags(mapOf("mytag", "myval")) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withSku(new SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE).withDev(true)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlManagedInstances_Delete + +```java +/** + * Samples for SqlManagedInstances Delete. + */ +public final class SqlManagedInstancesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteSqlManagedInstance.json + */ + /** + * Sample code: Delete a SQL Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances().delete("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_GetByResourceGroup + +```java +/** + * Samples for SqlManagedInstances GetByResourceGroup. + */ +public final class SqlManagedInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlManagedInstance.json + */ + /** + * Sample code: Updates a SQL Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances() + .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_List + +```java +/** + * Samples for SqlManagedInstances List. + */ +public final class SqlManagedInstancesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlManagedInstance.json + */ + /** + * Sample code: Gets all SQL Instance in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_ListByResourceGroup + +```java +/** + * Samples for SqlManagedInstances ListByResourceGroup. + */ +public final class SqlManagedInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlManagedInstance.json + */ + /** + * Sample code: Gets all SQL Instance in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlManagedInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlManagedInstances_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstance; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlManagedInstances Update. + */ +public final class SqlManagedInstancesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateSqlManagedInstance.json + */ + /** + * Sample code: Updates a sql Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASqlInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlManagedInstance resource = manager.sqlManagedInstances() + .getByResourceGroupWithResponse("testrg", "testsqlManagedInstance", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerAvailabilityGroups_AddDatabases + +```java +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups AddDatabases. + */ +public final class SqlServerAvailabilityGroupsAddDatabasesSamples { + /* + * x-ms-original-file: 2026-03-01-preview/AddDatabasesToAvailabilityGroup.json + */ + /** + * Sample code: add databases to this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + addDatabasesToThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1", "db2", "db3")), com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Create. + */ +public final class SqlServerAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create a Arc Sql Server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createAArcSqlServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .define("testAG") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServer_INST1") + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withInfo(new AvailabilityGroupInfo().withFailureConditionLevel(3) + .withHealthCheckTimeout(30000) + .withBasicFeatures(false) + .withDtcSupport(false) + .withDbFailover(true) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(0) + .withIsContained(false)) + .withReplicas( + new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue(Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("testSqlServer\\INST1") + .withConfigure(new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withSessionTimeout(10) + .withBackupPriority(50))))) + .withDatabases(new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db1"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db2"))))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerAvailabilityGroups_CreateAvailabilityGroup + +```java +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups CreateAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create an availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAnAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createAvailabilityGroup("testrg", "testSqlServer_INST1", new AvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("myNewAg") + .withReplicas(Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/") + .withEndpointName("inst1DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST1.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/") + .withEndpointName("inst2DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST2.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10))) + .withDatabases(Arrays.asList("database1", "database2")) + .withAutomatedBackupPreference(AutomatedBackupPreference.SECONDARY) + .withFailureConditionLevel(FailureConditionLevel.THREE) + .withHealthCheckTimeout(30000) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.NONE) + .withRequiredSynchronizedSecondariesToCommit(0) + .withClusterType(ClusterType.WSFC) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("myNewAgListener") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("192.1.168.5") + .withMask("255.255.255.0"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("10.1.168.5") + .withMask("255.255.255.0"))) + .withPort(1433)), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_CreateDistributedAvailabilityGroup + +```java +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; + +/** + * Samples for SqlServerAvailabilityGroups CreateDistributedAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateSqlServerDistributedAvailabilityGroup.json + */ + /** + * Sample code: Create a distributed availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createADistributedAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createDistributedAvailabilityGroup("testrg", "testSqlServer_INST1", + new DistributedAvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("myNewDag") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/availabilityGroups/testAG1") + .withListenerUrl("TCP://testAG1.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/availabilityGroups/testAG2") + .withListenerUrl("TCP://testAG2.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_CreateManagedInstanceLink + +```java +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.MiLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups CreateManagedInstanceLink. + */ +public final class SqlServerAvailabilityGroupsCreateManagedInstanceLinkSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateManagedInstanceLink.json + */ + /** + * Sample code: Create an Managed Instance Link. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAnManagedInstanceLink(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createManagedInstanceLink("testrg", "testSqlServer_INST1", + new ManagedInstanceLinkCreateUpdateConfiguration() + .withAvailabilityGroup( + new AvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("myNewAg") + .withReplicas(Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration() + .withEndpointUrl("TCP://testSqlServer_INST1.testSqlserverDomain:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL))) + .withDatabases(Arrays.asList("database1"))) + .withDistributedAvailabilityGroup(new DistributedAvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("myNewDag") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/availabilityGroups/testAG1") + .withListenerUrl("TCP://testAG1.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.AUTOMATIC))) + .withMiLinkConfiguration( + new MiLinkCreateUpdateConfiguration().withInstanceAvailabilityGroupName("testAG2")), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Delete + +```java +/** + * Samples for SqlServerAvailabilityGroups Delete. + */ +public final class SqlServerAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAAvailabilityGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .delete("testrg", "testsqlInstanceAvailabilityGroup", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_DeleteMiLink + +```java +/** + * Samples for SqlServerAvailabilityGroups DeleteMiLink. + */ +public final class SqlServerAvailabilityGroupsDeleteMiLinkSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteMiLink.json + */ + /** + * Sample code: Fail over from an Arc Sql Server availability group to a Managed Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void failOverFromAnArcSqlServerAvailabilityGroupToAManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .deleteMiLink("testrg", "testSqlServer_INST1", "testDAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_DetailView + +```java +/** + * Samples for SqlServerAvailabilityGroups DetailView. + */ +public final class SqlServerAvailabilityGroupsDetailViewSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ViewArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: detail view for a server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + detailViewForAServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .detailViewWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Failover + +```java +/** + * Samples for SqlServerAvailabilityGroups Failover. + */ +public final class SqlServerAvailabilityGroupsFailoverSamples { + /* + * x-ms-original-file: 2026-03-01-preview/FailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group manual failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void availabilityGroupManualFailoverToThisServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .failoverWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_FailoverMiLink + +```java +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; + +/** + * Samples for SqlServerAvailabilityGroups FailoverMiLink. + */ +public final class SqlServerAvailabilityGroupsFailoverMiLinkSamples { + /* + * x-ms-original-file: 2026-03-01-preview/failoverMiLink.json + */ + /** + * Sample code: Fail over from an Arc Sql Server availability group to a Managed Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void failOverFromAnArcSqlServerAvailabilityGroupToAManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .failoverMiLink("testrg", "testSqlServer_INST1", "testDAG", + new FailoverMiLinkResourceId().withManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_ForceFailoverAllowDataLoss + +```java +/** + * Samples for SqlServerAvailabilityGroups ForceFailoverAllowDataLoss. + */ +public final class SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ForceFailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group force failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + availabilityGroupForceFailoverToThisServer(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse("testrg", "testSqlServer_INST1", "testAG", + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Get + +```java +/** + * Samples for SqlServerAvailabilityGroups Get. + */ +public final class SqlServerAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_List + +```java +/** + * Samples for SqlServerAvailabilityGroups List. + */ +public final class SqlServerAvailabilityGroupsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups().list("testrg", "testSqlServer_INST1", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_RemoveDatabases + +```java +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups RemoveDatabases. + */ +public final class SqlServerAvailabilityGroupsRemoveDatabasesSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RemoveDatabasesFromAvailabilityGroup.json + */ + /** + * Sample code: remove databases from this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + removeDatabasesFromThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1")), com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerAvailabilityGroups_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Update. + */ +public final class SqlServerAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Update an availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAnAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerAvailabilityGroupResource resource = manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerDatabases_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.AdditionalMigrationJobAttributes; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigration; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseMigrationJobsItem; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Create. + */ +public final class SqlServerDatabasesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateArcSqlServerDatabase.json + */ + /** + * Sample code: Create a Arc Sql Server database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerDatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .define("testdb") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServerInstance") + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("SQL_Latin1_General_CP1_CI_AS") + .withDatabaseCreationDate(OffsetDateTime.parse("2022-04-05T16:26:33.883Z")) + .withCompatibilityLevel(150) + .withSizeMB(150.0D) + .withLogFileSizeMB(70.0D) + .withDataFileSizeMB(80.0D) + .withSpaceAvailableMB(100.0D) + .withState(DatabaseState.ONLINE) + .withIsReadOnly(true) + .withRecoveryMode(RecoveryMode.FULL) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(true) + .withIsAutoShrinkOn(true) + .withIsAutoCreateStatsOn(true) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(true) + .withIsMemoryOptimizationEnabled(true) + .withIsEncrypted(true) + .withIsTrustworthyOn(true) + .withIsHekatonFilesOn(false)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withLastLogBackup(OffsetDateTime.parse("2022-05-10T16:26:33.883Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.TWELVE) + .withTransactionLogBackupMinutes(30)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/testSqlServerInstance/testsqlManagedInstance/databases/MyDatabase") + .withRestorePointInTime(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withMigration(new DataBaseMigration().withJobs(Arrays.asList(new DatabaseMigrationJobsItem() + .withMigrationTrackingId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/SqlMigrationServices/my-migration-service") + .withMigrationMode(MigrationMode.LOG_SHIPPING) + .withInitiatedFrom(InitiatedFrom.DMSPORTAL) + .withTargetType(TargetType.AZURE_SQL_MANAGED_INSTANCE) + .withTargetResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/myDatabase") + .withAdditionalAttributes( + Arrays.asList(new AdditionalMigrationJobAttributes().withKeyName("fakeTokenPlaceholder") + .withKeyValue("fakeTokenPlaceholder"))))))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerDatabases_Delete + +```java +/** + * Samples for SqlServerDatabases Delete. + */ +public final class SqlServerDatabasesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteArcSqlServerDatabase.json + */ + /** + * Sample code: Deletes a database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesADatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .delete("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerDatabases_Get + +```java +/** + * Samples for SqlServerDatabases Get. + */ +public final class SqlServerDatabasesGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetArcSqlServerDatabase.json + */ + /** + * Sample code: Retrieves an Arc Sql Server database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAnArcSqlServerDatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .getWithResponse("testrg", "testSqlServerInstance", "testdb", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerDatabases_List + +```java +/** + * Samples for SqlServerDatabases List. + */ +public final class SqlServerDatabasesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListBySqlServerInstanceDatabase.json + */ + /** + * Sample code: Gets all databases associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllDatabasesAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases().list("testrg", "testSqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerDatabases_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Update. + */ +public final class SqlServerDatabasesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerDatabase.json + */ + /** + * Sample code: Update a database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateADatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerDatabaseResource resource = manager.sqlServerDatabases() + .getWithResponse("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerEsuLicenses_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Create. + */ +public final class SqlServerEsuLicensesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Updates a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .define("testsqlServerEsuLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withVersion(Version.SQLSERVER2016) + .withPhysicalCores(24) + .withActivationState(State.INACTIVE) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerEsuLicenses_Delete + +```java +/** + * Samples for SqlServerEsuLicenses Delete. + */ +public final class SqlServerEsuLicensesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteSqlServerEsuLicense.json + */ + /** + * Sample code: Delete a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_GetByResourceGroup + +```java +/** + * Samples for SqlServerEsuLicenses GetByResourceGroup. + */ +public final class SqlServerEsuLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerEsuLicense.json + */ + /** + * Sample code: Gets a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_List + +```java +/** + * Samples for SqlServerEsuLicenses List. + */ +public final class SqlServerEsuLicensesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerESULicensesInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_ListByResourceGroup + +```java +/** + * Samples for SqlServerEsuLicenses ListByResourceGroup. + */ +public final class SqlServerEsuLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLServerESULicensesInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerEsuLicenses_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Update. + */ +public final class SqlServerEsuLicensesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Patch a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerEsuLicense resource = manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("mytag", "myval")) + .withProperties(new SqlServerEsuLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(28) + .withActivationState(State.ACTIVE)) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerInstances_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.Authentication; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.BestPracticesAssessment; +import com.azure.resourcemanager.azurearcdata.models.ClientConnection; +import com.azure.resourcemanager.azurearcdata.models.CronTrigger; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.DiscoverySource; +import com.azure.resourcemanager.azurearcdata.models.EditionType; +import com.azure.resourcemanager.azurearcdata.models.EntraAuthentication; +import com.azure.resourcemanager.azurearcdata.models.HostType; +import com.azure.resourcemanager.azurearcdata.models.IdentityType; +import com.azure.resourcemanager.azurearcdata.models.Migration; +import com.azure.resourcemanager.azurearcdata.models.MigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.Mode; +import com.azure.resourcemanager.azurearcdata.models.Monitoring; +import com.azure.resourcemanager.azurearcdata.models.Schedule; +import com.azure.resourcemanager.azurearcdata.models.ServiceType; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlVersion; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerInstances Create. + */ +public final class SqlServerInstancesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlServerInstance.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .define("testsqlServerInstance") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQLSERVER2012) + .withEdition(EditionType.DEVELOPER) + .withCores("4") + .withDiscoverySource(DiscoverySource.SSMS) + .withInstanceName("name of instance") + .withHostType(HostType.PHYSICAL_SERVER) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.TWELVE) + .withTransactionLogBackupMinutes(30)) + .withMonitoring(new Monitoring().withEnabled(false)) + .withMigration(new Migration().withAssessment(new MigrationAssessment().withEnabled(false))) + .withBestPracticesAssessment(new BestPracticesAssessment().withEnabled(true) + .withSchedule(new Schedule().withEnabled(true) + .withCronTrigger(new CronTrigger().withExpression("0 0 12 1 11")))) + .withClientConnection(new ClientConnection().withEnabled(false)) + .withServiceType(ServiceType.ENGINE) + .withAuthentication(new Authentication().withMode(Mode.WINDOWS) + .withSqlServerEntraIdentity(Arrays.asList( + new EntraAuthentication().withIdentityType(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY) + .withClientId("00000000-1111-2222-3333-444444444444"), + new EntraAuthentication().withIdentityType(IdentityType.SYSTEM_ASSIGNED_MANAGED_IDENTITY) + .withClientId(""))))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerInstances_Delete + +```java +/** + * Samples for SqlServerInstances Delete. + */ +public final class SqlServerInstancesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteSqlServerInstance.json + */ + /** + * Sample code: Delete a SQL Server Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances().delete("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetAllAvailabilityGroups + +```java +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupTypeFilter; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.ReplicationPartnerType; + +/** + * Samples for SqlServerInstances GetAllAvailabilityGroups. + */ +public final class SqlServerInstancesGetAllAvailabilityGroupsSamples { + /* + * x-ms-original-file: 2026-03-01-preview/FilteredListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getAllAvailabilityGroups("exampleResourceGroup", "exampleSqlServerInstance", + new AvailabilityGroupRetrievalFilters() + .withAvailabilityGroupTypeFilter(ArcSqlServerAvailabilityGroupTypeFilter.DISTRIBUTED) + .withReplicationPartnerTypeFilter(ReplicationPartnerType.AZURE_SQLMANAGED_INSTANCE), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetBestPracticesAssessment + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaQueryType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaReportType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest; + +/** + * Samples for SqlServerInstances GetBestPracticesAssessment. + */ +public final class SqlServerInstancesGetBestPracticesAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceBpa.json + */ + /** + * Sample code: Retrieves Arc SQL Server best practices assessment results. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerBestPracticesAssessmentResults( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getBestPracticesAssessment("testrg", "testsqlserver", + new SqlServerInstanceBpaRequest().withReportType(SqlServerInstanceBpaReportType.ASSESSMENT_SUMMARY) + .withReportId("ad43a05f-efed-448a-ae53-5e4abd29068f") + .withQueryType(SqlServerInstanceBpaQueryType.BASIC), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetByResourceGroup + +```java +/** + * Samples for SqlServerInstances GetByResourceGroup. + */ +public final class SqlServerInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstance.json + */ + /** + * Sample code: Updates a SQL Server Instance tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetJobs + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; + +/** + * Samples for SqlServerInstances GetJobs. + */ +public final class SqlServerInstancesGetJobsSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceJobs.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance jobs status. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesArcSQLServerInstanceJobsStatus(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getJobs("testrg", "testsqlserver", + new SqlServerInstanceJobsRequest().withFeatureName("MigrationAssessment").withJobType("Ondemand"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetJobsStatus + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; + +/** + * Samples for SqlServerInstances GetJobsStatus. + */ +public final class SqlServerInstancesGetJobsStatusSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceJobsStatus.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance jobs status. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesArcSQLServerInstanceJobsStatus(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getJobsStatusWithResponse("testrg", "testsqlserver", + new SqlServerInstanceJobsStatusRequest().withFeatureName("MigrationAssessment").withJobType("Ondemand"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetMigrationReadinessReport + +```java +/** + * Samples for SqlServerInstances GetMigrationReadinessReport. + */ +public final class SqlServerInstancesGetMigrationReadinessReportSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceMigrationReadinessReport.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance migration readiness report. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceMigrationReadinessReport( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getMigrationReadinessReport("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetTargetRecommendationReports + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSectionType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import java.util.Arrays; + +/** + * Samples for SqlServerInstances GetTargetRecommendationReports. + */ +public final class SqlServerInstancesGetTargetRecommendationReportsSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTargetRecommendationReportsWithFilters.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance target recommendation reports with filters. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceTargetRecommendationReportsWithFilters( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTargetRecommendationReports("testrg", "testsqlserver", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(0) + .withSectionOffset(0) + .withSectionType( + SqlServerInstanceTargetRecommendationReportSectionType.SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE) + .withDatabaseNames(Arrays.asList("database1", "database2")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTargetRecommendationReports.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance target recommendation reports. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceTargetRecommendationReports( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTargetRecommendationReports("testrg", "testsqlserver", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(0).withSectionOffset(0), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTargetRecommendationReportsLastPage.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance target recommendation reports - last page. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceTargetRecommendationReportsLastPage( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTargetRecommendationReports("testrg", "testsqlserver", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(0).withSectionOffset(9), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_GetTelemetry + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import java.time.OffsetDateTime; + +/** + * Samples for SqlServerInstances GetTelemetry. + */ +public final class SqlServerInstancesGetTelemetrySamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTelemetry.json + */ + /** + * Sample code: Retrieves Arc SQL Server cpu utilization telemetry. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerCpuUtilizationTelemetry( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTelemetry("testrg", "testsqlserver", + new SqlServerInstanceTelemetryRequest().withDatasetName("sqlserver_storage_io") + .withStartTime(OffsetDateTime.parse("2023-09-30T00:00:00Z")), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_List + +```java +/** + * Samples for SqlServerInstances List. + */ +public final class SqlServerInstancesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlServerInstance.json + */ + /** + * Sample code: Gets all SQL Server Instance in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_ListByResourceGroup + +```java +/** + * Samples for SqlServerInstances ListByResourceGroup. + */ +public final class SqlServerInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlServerInstance.json + */ + /** + * Sample code: Gets all SQL Server Instance in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_PostUpgrade + +```java +/** + * Samples for SqlServerInstances PostUpgrade. + */ +public final class SqlServerInstancesPostUpgradeSamples { + /* + * x-ms-original-file: 2026-03-01-preview/PostUpgradeSqlServerInstance.json + */ + /** + * Sample code: Post AUM Upgrade to complete SQL Instance Upgrade Process. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void postAUMUpgradeToCompleteSQLInstanceUpgradeProcess( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .postUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_PreUpgrade + +```java +/** + * Samples for SqlServerInstances PreUpgrade. + */ +public final class SqlServerInstancesPreUpgradeSamples { + /* + * x-ms-original-file: 2026-03-01-preview/PreUpgradeSqlServerInstance.json + */ + /** + * Sample code: Prepare SQL server instance for AUM Upgrade. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + prepareSQLServerInstanceForAUMUpgrade(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .preUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunBestPracticeAssessment + +```java +/** + * Samples for SqlServerInstances RunBestPracticeAssessment. + */ +public final class SqlServerInstancesRunBestPracticeAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunBestPracticeAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger best practices assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerBestPracticesAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runBestPracticeAssessment("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunBestPracticesAssessment + +```java +/** + * Samples for SqlServerInstances RunBestPracticesAssessment. + */ +public final class SqlServerInstancesRunBestPracticesAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunBestPracticesAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger best practices assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerBestPracticesAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runBestPracticesAssessmentWithResponse("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunManagedInstanceLinkAssessment + +```java +import com.azure.resourcemanager.azurearcdata.models.AzureManagedInstanceRole; +import com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import java.util.Arrays; + +/** + * Samples for SqlServerInstances RunManagedInstanceLinkAssessment. + */ +public final class SqlServerInstancesRunManagedInstanceLinkAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunManagedInstanceLinkAssessment.json + */ + /** + * Sample code: Runs Managed Instance Link Assessments and retrieves the results. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void runsManagedInstanceLinkAssessmentsAndRetrievesTheResults( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runManagedInstanceLinkAssessment("testrg", "testsqlserver", + new SqlServerInstanceManagedInstanceLinkAssessmentRequest().withAzureManagedInstanceResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testmi") + .withAzureManagedInstanceRole(AzureManagedInstanceRole.SECONDARY) + .withDatabaseNames(Arrays.asList("testdb", "testdb2", "testdb3")) + .withAvailabilityGroupName("AG_testdb") + .withDistributedAvailabilityGroupName("MiLinkDag") + .withAssessmentCategories( + Arrays.asList(MiLinkAssessmentCategory.SQL_INSTANCE, MiLinkAssessmentCategory.MANAGED_INSTANCE, + MiLinkAssessmentCategory.MANAGED_INSTANCE_CROSS_VALIDATION, + MiLinkAssessmentCategory.DAG_CROSS_VALIDATION)) + .withSqlServerIpAddress("192.168.1.2"), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunMigrationAssessment + +```java +/** + * Samples for SqlServerInstances RunMigrationAssessment. + */ +public final class SqlServerInstancesRunMigrationAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunMigrationAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger migration assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerMigrationAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runMigrationAssessmentWithResponse("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunMigrationReadinessAssessment + +```java +/** + * Samples for SqlServerInstances RunMigrationReadinessAssessment. + */ +public final class SqlServerInstancesRunMigrationReadinessAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunMigrationReadinessAssessmentSqlServerInstance.json + */ + /** + * Sample code: Run migration readiness assessment on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void runMigrationReadinessAssessmentOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runMigrationReadinessAssessment("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_RunTargetRecommendationJob + +```java +import com.azure.resourcemanager.azurearcdata.models.ResourceUpdateMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; + +/** + * Samples for SqlServerInstances RunTargetRecommendationJob. + */ +public final class SqlServerInstancesRunTargetRecommendationJobSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunTargetRecommendationJobSqlServerInstance.json + */ + /** + * Sample code: Trigger target recommendation job on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerTargetRecommendationJobOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runTargetRecommendationJob("testrg", "testsqlserver", + new SqlServerInstanceRunTargetRecommendationJobRequest() + .withResourceUpdateMode(ResourceUpdateMode.UPDATE_ALL_TARGET_RECOMMENDATION_DETAILS) + .withIncludeFileLevelRequirements(false) + .withTargetLocation("westus") + .withPercentile(95) + .withLookbackPeriodInDays(30), + com.azure.core.util.Context.NONE); + } +} +``` + +### SqlServerInstances_Update + +```java +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; import java.util.HashMap; import java.util.Map; /** - * Samples for SqlServerInstances Create. + * Samples for SqlServerInstances Update. */ -public final class SqlServerInstancesCreateSamples { +public final class SqlServerInstancesUpdateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * CreateOrUpdateSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -526,26 +2582,61 @@ public final class SqlServerInstancesCreateSamples { */ public static void updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlServerInstances() - .define("testsqlServerInstance") + SqlServerInstance resource = manager.sqlServerInstances() + .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlServerLicenses_Create + +```java +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Create. + */ +public final class SqlServerLicensesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlServerLicense.json + */ + /** + * Sample code: Updates a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .define("testsqlServerLicense") .withRegion("northeurope") .withExistingResourceGroup("testrg") + .withProperties(new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withPhysicalCores(24) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)) .withTags(mapOf("mytag", "myval")) - .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2017) - .withEdition(EditionType.DEVELOPER) - .withContainerResourceId("Arc Machine Name") - .withVCore("4") - .withStatus(ConnectionStatus.CONNECTED) - .withPatchLevel("patchlevel") - .withCollation("collation") - .withCurrentVersion("2008 R2") - .withInstanceName("name of instance") - .withTcpDynamicPorts("1433") - .withTcpStaticPorts("1433") - .withProductId("sql id") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2020-01-02T17:18:19.1234567Z")) - .withAzureDefenderStatus(DefenderStatus.PROTECTED)) .create(); } @@ -563,127 +2654,116 @@ public final class SqlServerInstancesCreateSamples { } ``` -### SqlServerInstances_Delete +### SqlServerLicenses_Delete ```java /** - * Samples for SqlServerInstances Delete. + * Samples for SqlServerLicenses Delete. */ -public final class SqlServerInstancesDeleteSamples { +public final class SqlServerLicensesDeleteSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * DeleteSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/DeleteSqlServerLicense.json */ /** - * Sample code: Delete a SQL Server Instance. + * Sample code: Delete a SQL Server license. * * @param manager Entry point to AzureArcDataManager. */ - public static void deleteASQLServerInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlServerInstances().delete("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + public static void deleteASQLServerLicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); } } ``` -### SqlServerInstances_GetByResourceGroup +### SqlServerLicenses_GetByResourceGroup ```java /** - * Samples for SqlServerInstances GetByResourceGroup. + * Samples for SqlServerLicenses GetByResourceGroup. */ -public final class SqlServerInstancesGetByResourceGroupSamples { +public final class SqlServerLicensesGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * GetSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/GetSqlServerLicense.json */ /** - * Sample code: Updates a SQL Server Instance tags. + * Sample code: Gets a SQL Server license tags. * * @param manager Entry point to AzureArcDataManager. */ - public static void - updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlServerInstances() - .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + public static void getsASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); } } ``` -### SqlServerInstances_List +### SqlServerLicenses_List ```java /** - * Samples for SqlServerInstances List. + * Samples for SqlServerLicenses List. */ -public final class SqlServerInstancesListSamples { +public final class SqlServerLicensesListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListSubscriptionSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlServerLicense.json */ /** - * Sample code: Gets all SQL Server Instance in a subscription. + * Sample code: Gets all SQL Server license in a subscription. * * @param manager Entry point to AzureArcDataManager. */ public static void - getsAllSQLServerInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlServerInstances().list(com.azure.core.util.Context.NONE); + getsAllSQLServerLicenseInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().list(com.azure.core.util.Context.NONE); } } ``` -### SqlServerInstances_ListByResourceGroup +### SqlServerLicenses_ListByResourceGroup ```java /** - * Samples for SqlServerInstances ListByResourceGroup. + * Samples for SqlServerLicenses ListByResourceGroup. */ -public final class SqlServerInstancesListByResourceGroupSamples { +public final class SqlServerLicensesListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListByResourceGroupSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlServerLicense.json */ /** - * Sample code: Gets all SQL Server Instance in a resource group. + * Sample code: Gets all SQL Server license in a resource group. * * @param manager Entry point to AzureArcDataManager. */ public static void - getsAllSQLServerInstanceInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - manager.sqlServerInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + getsAllSQLServerLicenseInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); } } ``` -### SqlServerInstances_Update +### SqlServerLicenses_Update ```java -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; import java.util.HashMap; import java.util.Map; /** - * Samples for SqlServerInstances Update. + * Samples for SqlServerLicenses Update. */ -public final class SqlServerInstancesUpdateSamples { +public final class SqlServerLicensesUpdateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * UpdateSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerLicense.json */ /** - * Sample code: Updates a SQL Server Instance tags. + * Sample code: Patch a SQL Server license tags. * * @param manager Entry point to AzureArcDataManager. */ - public static void - updatesASQLServerInstanceTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { - SqlServerInstance resource = manager.sqlServerInstances() - .getByResourceGroupWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE) + public static void patchASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerLicense resource = manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE) .getValue(); resource.update().withTags(mapOf("mytag", "myval")).apply(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml index 286b3ac74b87..feb72419641d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/pom.xml @@ -1,9 +1,9 @@ - + 4.0.0 com.azure @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for AzureArcData Management - This package contains Microsoft Azure SDK for AzureArcData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package tag package-2021-08-01. + This package contains Microsoft Azure SDK for AzureArcData Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. Package api-version 2026-03-01-preview. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ UTF-8 0 0 - false + true diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java index 39b41ffb0537..46708237d139 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata; @@ -22,21 +22,37 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient; +import com.azure.resourcemanager.azurearcdata.implementation.ActiveDirectoryConnectorsImpl; import com.azure.resourcemanager.azurearcdata.implementation.AzureArcDataManagementClientBuilder; import com.azure.resourcemanager.azurearcdata.implementation.DataControllersImpl; +import com.azure.resourcemanager.azurearcdata.implementation.FailoverGroupsImpl; import com.azure.resourcemanager.azurearcdata.implementation.OperationsImpl; +import com.azure.resourcemanager.azurearcdata.implementation.PostgresInstancesImpl; import com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerAvailabilityGroupsImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerDatabasesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerEsuLicensesImpl; import com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesImpl; +import com.azure.resourcemanager.azurearcdata.implementation.SqlServerLicensesImpl; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectors; import com.azure.resourcemanager.azurearcdata.models.DataControllers; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroups; import com.azure.resourcemanager.azurearcdata.models.Operations; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstances; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstances; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroups; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenses; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenses; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -52,8 +68,22 @@ public final class AzureArcDataManager { private SqlServerInstances sqlServerInstances; + private SqlServerLicenses sqlServerLicenses; + + private PostgresInstances postgresInstances; + + private SqlServerEsuLicenses sqlServerEsuLicenses; + + private FailoverGroups failoverGroups; + + private SqlServerAvailabilityGroups sqlServerAvailabilityGroups; + private DataControllers dataControllers; + private ActiveDirectoryConnectors activeDirectoryConnectors; + + private SqlServerDatabases sqlServerDatabases; + private final AzureArcDataManagementClient clientObject; private AzureArcDataManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -106,6 +136,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-azurearcdata.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -213,12 +246,14 @@ public AzureArcDataManager authenticate(TokenCredential credential, AzureProfile Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.azurearcdata") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -300,6 +335,67 @@ public SqlServerInstances sqlServerInstances() { return sqlServerInstances; } + /** + * Gets the resource collection API of SqlServerLicenses. It manages SqlServerLicense. + * + * @return Resource collection API of SqlServerLicenses. + */ + public SqlServerLicenses sqlServerLicenses() { + if (this.sqlServerLicenses == null) { + this.sqlServerLicenses = new SqlServerLicensesImpl(clientObject.getSqlServerLicenses(), this); + } + return sqlServerLicenses; + } + + /** + * Gets the resource collection API of PostgresInstances. It manages PostgresInstance. + * + * @return Resource collection API of PostgresInstances. + */ + public PostgresInstances postgresInstances() { + if (this.postgresInstances == null) { + this.postgresInstances = new PostgresInstancesImpl(clientObject.getPostgresInstances(), this); + } + return postgresInstances; + } + + /** + * Gets the resource collection API of SqlServerEsuLicenses. It manages SqlServerEsuLicense. + * + * @return Resource collection API of SqlServerEsuLicenses. + */ + public SqlServerEsuLicenses sqlServerEsuLicenses() { + if (this.sqlServerEsuLicenses == null) { + this.sqlServerEsuLicenses = new SqlServerEsuLicensesImpl(clientObject.getSqlServerEsuLicenses(), this); + } + return sqlServerEsuLicenses; + } + + /** + * Gets the resource collection API of FailoverGroups. It manages FailoverGroupResource. + * + * @return Resource collection API of FailoverGroups. + */ + public FailoverGroups failoverGroups() { + if (this.failoverGroups == null) { + this.failoverGroups = new FailoverGroupsImpl(clientObject.getFailoverGroups(), this); + } + return failoverGroups; + } + + /** + * Gets the resource collection API of SqlServerAvailabilityGroups. It manages SqlServerAvailabilityGroupResource. + * + * @return Resource collection API of SqlServerAvailabilityGroups. + */ + public SqlServerAvailabilityGroups sqlServerAvailabilityGroups() { + if (this.sqlServerAvailabilityGroups == null) { + this.sqlServerAvailabilityGroups + = new SqlServerAvailabilityGroupsImpl(clientObject.getSqlServerAvailabilityGroups(), this); + } + return sqlServerAvailabilityGroups; + } + /** * Gets the resource collection API of DataControllers. It manages DataControllerResource. * @@ -312,6 +408,31 @@ public DataControllers dataControllers() { return dataControllers; } + /** + * Gets the resource collection API of ActiveDirectoryConnectors. It manages ActiveDirectoryConnectorResource. + * + * @return Resource collection API of ActiveDirectoryConnectors. + */ + public ActiveDirectoryConnectors activeDirectoryConnectors() { + if (this.activeDirectoryConnectors == null) { + this.activeDirectoryConnectors + = new ActiveDirectoryConnectorsImpl(clientObject.getActiveDirectoryConnectors(), this); + } + return activeDirectoryConnectors; + } + + /** + * Gets the resource collection API of SqlServerDatabases. It manages SqlServerDatabaseResource. + * + * @return Resource collection API of SqlServerDatabases. + */ + public SqlServerDatabases sqlServerDatabases() { + if (this.sqlServerDatabases == null) { + this.sqlServerDatabases = new SqlServerDatabasesImpl(clientObject.getSqlServerDatabases(), this); + } + return sqlServerDatabases; + } + /** * Gets wrapped service client AzureArcDataManagementClient providing direct access to the underlying auto-generated * API implementation, based on Azure REST API. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java new file mode 100644 index 000000000000..06dba412f7d0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; + +/** + * An instance of this class provides access to all the operations defined in ActiveDirectoryConnectorsClient. + */ +public interface ActiveDirectoryConnectorsClient { + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryConnectorResourceInner get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActiveDirectoryConnectorResourceInner> beginCreate( + String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActiveDirectoryConnectorResourceInner> beginCreate( + String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, Context context); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource); + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + Context context); + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String dataControllerName); + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String dataControllerName, + Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java index 30aed74e1558..21ad7b960505 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent; @@ -12,26 +12,26 @@ */ public interface AzureArcDataManagementClient { /** - * Gets The ID of the Azure subscription. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets server parameter. + * Gets Service host. * * @return the endpoint value. */ String getEndpoint(); /** - * Gets Api Version. + * Gets Version parameter. * * @return the apiVersion value. */ String getApiVersion(); + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + /** * Gets The HTTP pipeline to send requests through. * @@ -67,10 +67,59 @@ public interface AzureArcDataManagementClient { */ SqlServerInstancesClient getSqlServerInstances(); + /** + * Gets the SqlServerLicensesClient object to access its operations. + * + * @return the SqlServerLicensesClient object. + */ + SqlServerLicensesClient getSqlServerLicenses(); + + /** + * Gets the PostgresInstancesClient object to access its operations. + * + * @return the PostgresInstancesClient object. + */ + PostgresInstancesClient getPostgresInstances(); + + /** + * Gets the SqlServerEsuLicensesClient object to access its operations. + * + * @return the SqlServerEsuLicensesClient object. + */ + SqlServerEsuLicensesClient getSqlServerEsuLicenses(); + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + FailoverGroupsClient getFailoverGroups(); + + /** + * Gets the SqlServerAvailabilityGroupsClient object to access its operations. + * + * @return the SqlServerAvailabilityGroupsClient object. + */ + SqlServerAvailabilityGroupsClient getSqlServerAvailabilityGroups(); + /** * Gets the DataControllersClient object to access its operations. * * @return the DataControllersClient object. */ DataControllersClient getDataControllers(); + + /** + * Gets the ActiveDirectoryConnectorsClient object to access its operations. + * + * @return the ActiveDirectoryConnectorsClient object. + */ + ActiveDirectoryConnectorsClient getActiveDirectoryConnectors(); + + /** + * Gets the SqlServerDatabasesClient object to access its operations. + * + * @return the SqlServerDatabasesClient object. + */ + SqlServerDatabasesClient getSqlServerDatabases(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java index fd3c23081e65..98b4abe2de3f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent; @@ -19,57 +19,38 @@ */ public interface DataControllersClient { /** - * List dataController resources in the subscription. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - - /** - * List dataController resources in the resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String dataControllerName, Context context); /** - * List dataController resources in the resource group. + * Retrieves a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + DataControllerResourceInner getByResourceGroup(String resourceGroupName, String dataControllerName); /** * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -83,8 +64,8 @@ SyncPoller, DataControllerResourceInner> /** * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -100,8 +81,8 @@ SyncPoller, DataControllerResourceInner> /** * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -115,8 +96,8 @@ DataControllerResourceInner putDataController(String resourceGroupName, String d /** * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -128,11 +109,74 @@ DataControllerResourceInner putDataController(String resourceGroupName, String d DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource, Context context); + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource); + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of data controller resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, + Context context); + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return data controller resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource); + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return data controller resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource, Context context); + /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -144,8 +188,8 @@ DataControllerResourceInner putDataController(String resourceGroupName, String d /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -159,8 +203,8 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -171,8 +215,8 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -182,61 +226,49 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String void delete(String resourceGroupName, String dataControllerName, Context context); /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String dataControllerName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - DataControllerResourceInner getByResourceGroup(String resourceGroupName, String dataControllerName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response patchDataControllerWithResponse(String resourceGroupName, - String dataControllerName, DataControllerUpdate dataControllerResource, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, - DataControllerUpdate dataControllerResource); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java new file mode 100644 index 000000000000..947e88205174 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; + +/** + * An instance of this class provides access to all the operations defined in FailoverGroupsClient. + */ +public interface FailoverGroupsClient { + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupResourceInner get(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupResourceInner> beginCreate(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupResourceInner> beginCreate(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, + Context context); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource); + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource, Context context); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, Context context); + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName); + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, + Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java index 070e61ecebaf..16fef3801b63 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java new file mode 100644 index 000000000000..19b6c320dc82 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate; + +/** + * An instance of this class provides access to all the operations defined in PostgresInstancesClient. + */ +public interface PostgresInstancesClient { + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String postgresInstanceName, Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner getByResourceGroup(String resourceGroupName, String postgresInstanceName); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource, Context context); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource); + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource, + Context context); + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters, Context context); + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PostgresInstanceInner update(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String postgresInstanceName, + Context context); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String postgresInstanceName, Context context); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List postgres Instance resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List postgres Instance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java index 73e6fef3ebbf..b2339ab1d72e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent; @@ -18,61 +18,10 @@ * An instance of this class provides access to all the operations defined in SqlManagedInstancesClient. */ public interface SqlManagedInstancesClient { - /** - * List sqlManagedInstance resources in the subscription. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List sqlManagedInstance resources in the subscription. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - /** * Retrieves a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -87,7 +36,7 @@ Response getByResourceGroupWithResponse(String resource /** * Retrieves a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -100,8 +49,8 @@ Response getByResourceGroupWithResponse(String resource /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -115,8 +64,8 @@ SyncPoller, SqlManagedInstanceInner> beginCr /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -131,8 +80,8 @@ SyncPoller, SqlManagedInstanceInner> beginCr /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -146,8 +95,8 @@ SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstan /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -159,11 +108,42 @@ SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstan SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context); + /** + * Updates a SQL Managed Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param parameters The SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlManagedInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters, Context context); + + /** + * Updates a SQL Managed Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param parameters The SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlManagedInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlManagedInstanceInner update(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters); + /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -175,8 +155,8 @@ SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstan /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -190,8 +170,8 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -202,8 +182,8 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -213,33 +193,53 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String void delete(String resourceGroupName, String sqlManagedInstanceName, Context context); /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlManagedInstance resources in the resource group + * + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response}. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceUpdate parameters, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlManagedInstance resources in the subscription. + * + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - SqlManagedInstanceInner update(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceUpdate parameters); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java new file mode 100644 index 000000000000..c5c27b6c9ecb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java @@ -0,0 +1,727 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerAvailabilityGroupsClient. + */ +public interface SqlServerAvailabilityGroupsClient { + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, Context context); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context); + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateManagedInstanceLink(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration); + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateManagedInstanceLink(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context); + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createManagedInstanceLink(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration); + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner createManagedInstanceLink(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, Context context); + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner create(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, Context context); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate); + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response forceFailoverAllowDataLossWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginFailoverMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginFailoverMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId, Context context); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner failoverMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner failoverMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId, Context context); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerAvailabilityGroupResourceInner removeDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java new file mode 100644 index 000000000000..935548c48ee5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerDatabasesClient. + */ +public interface SqlServerDatabasesClient { + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner get(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource, Context context); + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner create(String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseResourceInner sqlServerDatabaseResource); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate); + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java new file mode 100644 index 000000000000..2b8f3f640d7c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerEsuLicensesClient. + */ +public interface SqlServerEsuLicensesClient { + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerEsuLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName); + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense, Context context); + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerEsuLicenseInner create(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense); + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters, Context context); + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerEsuLicenseInner update(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, Context context); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerEsuLicenseName); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java index 05e761d06bd6..38c81d7a9202 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent; @@ -11,113 +11,143 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; +import java.util.List; /** * An instance of this class provides access to all the operations defined in SqlServerInstancesClient. */ public interface SqlServerInstancesClient { /** - * List sqlServerInstance resources in the subscription. + * Retrieves a SQL Server Instance resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + * @return a SqlServerInstance along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context); /** - * List sqlServerInstance resources in the subscription. + * Retrieves a SQL Server Instance resource. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + * @return a SqlServerInstance. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceInner getByResourceGroup(String resourceGroupName, String sqlServerInstanceName); /** - * List sqlServerInstance resources in the resource group - * - * Gets all sqlServerInstances in a resource group. + * Creates or replaces a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance); /** - * List sqlServerInstance resources in the resource group - * - * Gets all sqlServerInstances in a resource group. + * Creates or replaces a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context); /** - * Retrieves a SQL Server Instance resource. + * Creates or replaces a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. - * @param context The context to associate with this operation. + * @param sqlServerInstance The SQL Server Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response}. + * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String sqlServerInstanceName, Context context); + SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance); /** - * Retrieves a SQL Server Instance resource. + * Creates or replaces a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner getByResourceGroup(String resourceGroupName, String sqlServerInstanceName); + SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance, Context context); /** - * Creates or replaces a SQL Server Instance resource. + * Updates a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance); + SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters); /** - * Creates or replaces a SQL Server Instance resource. + * Updates a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -125,30 +155,30 @@ SyncPoller, SqlServerInstanceInner> beginCrea * @return the {@link SyncPoller} for polling of a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context); + SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context); /** - * Creates or replaces a SQL Server Instance resource. + * Updates a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance); + SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters); /** - * Creates or replaces a SQL Server Instance resource. + * Updates a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -156,14 +186,14 @@ SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstance * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, Context context); + SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters, Context context); /** * Deletes a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -175,8 +205,8 @@ SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstance /** * Deletes a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -190,8 +220,8 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Deletes a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -202,8 +232,8 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * Deletes a SQL Server Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -213,33 +243,776 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String void delete(String resourceGroupName, String sqlServerInstanceName, Context context); /** - * Updates a SQL Server Instance resource. + * List sqlServerInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response}. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List sqlServerInstance resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlServerInstance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context); + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable> getBestPracticesAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest); + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable> getBestPracticesAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceUpdate parameters, Context context); + Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); /** - * Updates a SQL Server Instance resource. + * Runs migration assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance. + * @return the response for running migration assessment on the SQL Server instance. */ @ServiceMethod(returns = ReturnType.SINGLE) - SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceUpdate parameters); + SqlServerInstanceRunMigrationAssessmentResponseInner runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJob(String resourceGroupName, String sqlServerInstanceName); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJob(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunTargetRecommendationJobResponseInner runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunTargetRecommendationJobResponseInner runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReports(String resourceGroupName, String sqlServerInstanceName); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReports(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceTargetRecommendationReportsResponseInner getTargetRecommendationReports(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceTargetRecommendationReportsResponseInner getTargetRecommendationReports(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceMigrationReadinessReportResponseInner> + beginGetMigrationReadinessReport(String resourceGroupName, String sqlServerInstanceName); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceMigrationReadinessReportResponseInner> + beginGetMigrationReadinessReport(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceMigrationReadinessReportResponseInner getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceMigrationReadinessReportResponseInner getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName, Context context); + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + runBestPracticesAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunBestPracticesAssessmentResponseInner runBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceRunBestPracticesAssessmentResponseInner> + beginRunBestPracticeAssessment(String resourceGroupName, String sqlServerInstanceName); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceRunBestPracticesAssessmentResponseInner> + beginRunBestPracticeAssessment(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunBestPracticesAssessmentResponseInner runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunBestPracticesAssessmentResponseInner runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName, Context context); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner> + beginRunMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner> + beginRunMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner + runMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner + runMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceJobsStatusResponseInner getJobsStatus(String resourceGroupName, String sqlServerInstanceName); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceJobsResponseInner> + beginGetJobs(String resourceGroupName, String sqlServerInstanceName); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceJobsResponseInner> beginGetJobs( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceJobsResponseInner getJobs(String resourceGroupName, String sqlServerInstanceName); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceJobsResponseInner getJobs(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceInner preUpgrade(String resourceGroupName, String sqlServerInstanceName); + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceInner postUpgrade(String resourceGroupName, String sqlServerInstanceName); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner> + beginRunManagedInstanceLinkAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner> + beginRunManagedInstanceLinkAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner runManagedInstanceLinkAssessment( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner runManagedInstanceLinkAssessment( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context); + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, + Context context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java new file mode 100644 index 000000000000..0138eba2976b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; + +/** + * An instance of this class provides access to all the operations defined in SqlServerLicensesClient. + */ +public interface SqlServerLicensesClient { + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerLicenseName, Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerLicenseName); + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense, Context context); + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerLicenseInner create(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense); + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters, Context context); + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlServerLicenseInner update(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String sqlServerLicenseName, Context context); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String sqlServerLicenseName); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List sqlServerLicense resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List sqlServerLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java new file mode 100644 index 000000000000..b3edaf01d033 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import java.io.IOException; + +/** + * Active directory connector resource. + */ +@Fluent +public final class ActiveDirectoryConnectorResourceInner extends ProxyResource { + /* + * null + */ + private ActiveDirectoryConnectorProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ActiveDirectoryConnectorResourceInner class. + */ + public ActiveDirectoryConnectorResourceInner() { + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public ActiveDirectoryConnectorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the ActiveDirectoryConnectorResourceInner object itself. + */ + public ActiveDirectoryConnectorResourceInner withProperties(ActiveDirectoryConnectorProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorResourceInner. + */ + public static ActiveDirectoryConnectorResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorResourceInner deserializedActiveDirectoryConnectorResourceInner + = new ActiveDirectoryConnectorResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.properties + = ActiveDirectoryConnectorProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedActiveDirectoryConnectorResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java index 5c93163c937d..d79b9bc95079 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent.models; import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -22,17 +21,17 @@ @Fluent public final class DataControllerResourceInner extends Resource { /* - * The extendedLocation of the resource. + * The data controller's properties */ - private ExtendedLocation extendedLocation; + private DataControllerProperties properties; /* - * The data controller's properties + * The extendedLocation of the resource. */ - private DataControllerProperties properties; + private ExtendedLocation extendedLocation; /* - * Read only system data + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ private SystemData systemData; @@ -58,47 +57,47 @@ public DataControllerResourceInner() { } /** - * Get the extendedLocation property: The extendedLocation of the resource. + * Get the properties property: The data controller's properties. * - * @return the extendedLocation value. + * @return the properties value. */ - public ExtendedLocation extendedLocation() { - return this.extendedLocation; + public DataControllerProperties properties() { + return this.properties; } /** - * Set the extendedLocation property: The extendedLocation of the resource. + * Set the properties property: The data controller's properties. * - * @param extendedLocation the extendedLocation value to set. + * @param properties the properties value to set. * @return the DataControllerResourceInner object itself. */ - public DataControllerResourceInner withExtendedLocation(ExtendedLocation extendedLocation) { - this.extendedLocation = extendedLocation; + public DataControllerResourceInner withProperties(DataControllerProperties properties) { + this.properties = properties; return this; } /** - * Get the properties property: The data controller's properties. + * Get the extendedLocation property: The extendedLocation of the resource. * - * @return the properties value. + * @return the extendedLocation value. */ - public DataControllerProperties properties() { - return this.properties; + public ExtendedLocation extendedLocation() { + return this.extendedLocation; } /** - * Set the properties property: The data controller's properties. + * Set the extendedLocation property: The extendedLocation of the resource. * - * @param properties the properties value to set. + * @param extendedLocation the extendedLocation value to set. * @return the DataControllerResourceInner object itself. */ - public DataControllerResourceInner withProperties(DataControllerProperties properties) { - this.properties = properties; + public DataControllerResourceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; return this; } /** - * Get the systemData property: Read only system data. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -154,26 +153,6 @@ public DataControllerResourceInner withTags(Map tags) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (extendedLocation() != null) { - extendedLocation().validate(); - } - if (properties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property properties in model DataControllerResourceInner")); - } else { - properties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(DataControllerResourceInner.class); - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java new file mode 100644 index 000000000000..9b22fab170e9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import java.io.IOException; + +/** + * A failover group resource. + */ +@Fluent +public final class FailoverGroupResourceInner extends ProxyResource { + /* + * null + */ + private FailoverGroupProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of FailoverGroupResourceInner class. + */ + public FailoverGroupResourceInner() { + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public FailoverGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the FailoverGroupResourceInner object itself. + */ + public FailoverGroupResourceInner withProperties(FailoverGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverGroupResourceInner. + */ + public static FailoverGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupResourceInner deserializedFailoverGroupResourceInner = new FailoverGroupResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFailoverGroupResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFailoverGroupResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFailoverGroupResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFailoverGroupResourceInner.properties = FailoverGroupProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFailoverGroupResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverGroupResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java index 112051d2868c..bea7954bccec 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,7 +17,7 @@ /** * Azure Data Services on Azure Arc operation definition. */ -@Fluent +@Immutable public final class OperationInner implements JsonSerializable { /* * The name of the operation being performed on this particular object. @@ -48,7 +47,7 @@ public final class OperationInner implements JsonSerializable { /** * Creates an instance of OperationInner class. */ - public OperationInner() { + private OperationInner() { } /** @@ -60,17 +59,6 @@ public String name() { return this.name; } - /** - * Set the name property: The name of the operation being performed on this particular object. - * - * @param name the name value to set. - * @return the OperationInner object itself. - */ - public OperationInner withName(String name) { - this.name = name; - return this; - } - /** * Get the display property: The localized display information for this particular operation / action. * @@ -80,17 +68,6 @@ public OperationDisplay display() { return this.display; } - /** - * Set the display property: The localized display information for this particular operation / action. - * - * @param display the display value to set. - * @return the OperationInner object itself. - */ - public OperationInner withDisplay(OperationDisplay display) { - this.display = display; - return this; - } - /** * Get the origin property: The intended executor of the operation. * @@ -109,17 +86,6 @@ public boolean isDataAction() { return this.isDataAction; } - /** - * Set the isDataAction property: Indicates whether the operation is a data action. - * - * @param isDataAction the isDataAction value to set. - * @return the OperationInner object itself. - */ - public OperationInner withIsDataAction(boolean isDataAction) { - this.isDataAction = isDataAction; - return this; - } - /** * Get the properties property: Additional descriptions for the operation. * @@ -129,26 +95,6 @@ public Map properties() { return this.properties; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property name in model OperationInner")); - } - if (display() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property display in model OperationInner")); - } else { - display().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(OperationInner.class); - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java new file mode 100644 index 000000000000..8931e2a04923 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import java.io.IOException; +import java.util.Map; + +/** + * A Postgres Instance. + */ +@Fluent +public final class PostgresInstanceInner extends Resource { + /* + * null + */ + private PostgresInstanceProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * Resource sku. + */ + private PostgresInstanceSku sku; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PostgresInstanceInner class. + */ + public PostgresInstanceInner() { + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public PostgresInstanceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the PostgresInstanceInner object itself. + */ + public PostgresInstanceInner withProperties(PostgresInstanceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the PostgresInstanceInner object itself. + */ + public PostgresInstanceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the sku property: Resource sku. + * + * @return the sku value. + */ + public PostgresInstanceSku sku() { + return this.sku; + } + + /** + * Set the sku property: Resource sku. + * + * @param sku the sku value to set. + * @return the PostgresInstanceInner object itself. + */ + public PostgresInstanceInner withSku(PostgresInstanceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PostgresInstanceInner. + */ + public static PostgresInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceInner deserializedPostgresInstanceInner = new PostgresInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPostgresInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPostgresInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPostgresInstanceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPostgresInstanceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPostgresInstanceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPostgresInstanceInner.properties = PostgresInstanceProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedPostgresInstanceInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedPostgresInstanceInner.sku = PostgresInstanceSku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPostgresInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java index 567a16fabc0b..72e6cad4f3a1 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent.models; import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -38,7 +37,7 @@ public final class SqlManagedInstanceInner extends Resource { private SqlManagedInstanceSku sku; /* - * Read only system data + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ private SystemData systemData; @@ -124,7 +123,7 @@ public SqlManagedInstanceInner withSku(SqlManagedInstanceSku sku) { } /** - * Get the systemData property: Read only system data. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -180,29 +179,6 @@ public SqlManagedInstanceInner withTags(Map tags) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (properties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property properties in model SqlManagedInstanceInner")); - } else { - properties().validate(); - } - if (extendedLocation() != null) { - extendedLocation().validate(); - } - if (sku() != null) { - sku().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(SqlManagedInstanceInner.class); - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java new file mode 100644 index 000000000000..d62a2ed15cb5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Arc Sql Server Availability Group. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourceInner extends Resource { + /* + * Properties of Arc Sql Server availability group + */ + private SqlServerAvailabilityGroupResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourceInner class. + */ + public SqlServerAvailabilityGroupResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Server availability group. + * + * @return the properties value. + */ + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Server availability group. + * + * @param properties the properties value to set. + * @return the SqlServerAvailabilityGroupResourceInner object itself. + */ + public SqlServerAvailabilityGroupResourceInner + withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerAvailabilityGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerAvailabilityGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourceInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourceInner. + */ + public static SqlServerAvailabilityGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourceInner deserializedSqlServerAvailabilityGroupResourceInner + = new SqlServerAvailabilityGroupResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerAvailabilityGroupResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.properties + = SqlServerAvailabilityGroupResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java new file mode 100644 index 000000000000..9d754745e30d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Arc Sql Server database. + */ +@Fluent +public final class SqlServerDatabaseResourceInner extends Resource { + /* + * Properties of Arc Sql Server database + */ + private SqlServerDatabaseResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerDatabaseResourceInner class. + */ + public SqlServerDatabaseResourceInner() { + } + + /** + * Get the properties property: Properties of Arc Sql Server database. + * + * @return the properties value. + */ + public SqlServerDatabaseResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Arc Sql Server database. + * + * @param properties the properties value to set. + * @return the SqlServerDatabaseResourceInner object itself. + */ + public SqlServerDatabaseResourceInner withProperties(SqlServerDatabaseResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerDatabaseResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerDatabaseResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourceInner. + */ + public static SqlServerDatabaseResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourceInner deserializedSqlServerDatabaseResourceInner + = new SqlServerDatabaseResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerDatabaseResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.properties + = SqlServerDatabaseResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerDatabaseResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourceInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java new file mode 100644 index 000000000000..b747c44830b9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Describe SQL Server ESU license resource. + */ +@Fluent +public final class SqlServerEsuLicenseInner extends Resource { + /* + * SQL Server ESU license properties + */ + private SqlServerEsuLicenseProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerEsuLicenseInner class. + */ + public SqlServerEsuLicenseInner() { + } + + /** + * Get the properties property: SQL Server ESU license properties. + * + * @return the properties value. + */ + public SqlServerEsuLicenseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: SQL Server ESU license properties. + * + * @param properties the properties value to set. + * @return the SqlServerEsuLicenseInner object itself. + */ + public SqlServerEsuLicenseInner withProperties(SqlServerEsuLicenseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerEsuLicenseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerEsuLicenseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseInner. + */ + public static SqlServerEsuLicenseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseInner deserializedSqlServerEsuLicenseInner = new SqlServerEsuLicenseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerEsuLicenseInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.properties = SqlServerEsuLicenseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerEsuLicenseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java index 6d77913a436a..22bd9e2127cd 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.fluent.models; @@ -25,7 +25,7 @@ public final class SqlServerInstanceInner extends Resource { private SqlServerInstanceProperties properties; /* - * Read only system data + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ private SystemData systemData; @@ -71,7 +71,7 @@ public SqlServerInstanceInner withProperties(SqlServerInstanceProperties propert } /** - * Get the systemData property: Read only system data. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -127,17 +127,6 @@ public SqlServerInstanceInner withTags(Map tags) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (properties() != null) { - properties().validate(); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsResponseInner.java new file mode 100644 index 000000000000..712496a90d9f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsResponseInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJob; +import java.io.IOException; +import java.util.List; + +/** + * The response for the jobs running on the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceJobsResponseInner implements JsonSerializable { + /* + * The list of jobs running on the SQL Server instance. + */ + private List jobs; + + /** + * Creates an instance of SqlServerInstanceJobsResponseInner class. + */ + private SqlServerInstanceJobsResponseInner() { + } + + /** + * Get the jobs property: The list of jobs running on the SQL Server instance. + * + * @return the jobs value. + */ + public List jobs() { + return this.jobs; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("jobs", this.jobs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobsResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobsResponseInner. + */ + public static SqlServerInstanceJobsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobsResponseInner deserializedSqlServerInstanceJobsResponseInner + = new SqlServerInstanceJobsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobs".equals(fieldName)) { + List jobs + = reader.readArray(reader1 -> SqlServerInstanceJob.fromJson(reader1)); + deserializedSqlServerInstanceJobsResponseInner.jobs = jobs; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobsResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.java new file mode 100644 index 000000000000..4e4e0ca41811 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobStatus; +import java.io.IOException; +import java.util.List; + +/** + * The response for the status of the jobs running on the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceJobsStatusResponseInner + implements JsonSerializable { + /* + * The list of jobs status running on the SQL Server instance. + */ + private List jobsStatus; + + /** + * Creates an instance of SqlServerInstanceJobsStatusResponseInner class. + */ + private SqlServerInstanceJobsStatusResponseInner() { + } + + /** + * Get the jobsStatus property: The list of jobs status running on the SQL Server instance. + * + * @return the jobsStatus value. + */ + public List jobsStatus() { + return this.jobsStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("jobsStatus", this.jobsStatus, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobsStatusResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobsStatusResponseInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobsStatusResponseInner. + */ + public static SqlServerInstanceJobsStatusResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobsStatusResponseInner deserializedSqlServerInstanceJobsStatusResponseInner + = new SqlServerInstanceJobsStatusResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobsStatus".equals(fieldName)) { + List jobsStatus + = reader.readArray(reader1 -> SqlServerInstanceJobStatus.fromJson(reader1)); + deserializedSqlServerInstanceJobsStatusResponseInner.jobsStatus = jobsStatus; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobsStatusResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.java new file mode 100644 index 000000000000..f27786713ba2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessment; +import java.io.IOException; +import java.util.List; + +/** + * The response containing the results of the MI Link assessment. + */ +@Immutable +public final class SqlServerInstanceManagedInstanceLinkAssessmentResponseInner + implements JsonSerializable { + /* + * The list of the results for MI Link assessment. + */ + private List assessments; + + /** + * Creates an instance of SqlServerInstanceManagedInstanceLinkAssessmentResponseInner class. + */ + private SqlServerInstanceManagedInstanceLinkAssessmentResponseInner() { + } + + /** + * Get the assessments property: The list of the results for MI Link assessment. + * + * @return the assessments value. + */ + public List assessments() { + return this.assessments; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("assessments", this.assessments, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceManagedInstanceLinkAssessmentResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceManagedInstanceLinkAssessmentResponseInner if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SqlServerInstanceManagedInstanceLinkAssessmentResponseInner. + */ + public static SqlServerInstanceManagedInstanceLinkAssessmentResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner deserializedSqlServerInstanceManagedInstanceLinkAssessmentResponseInner + = new SqlServerInstanceManagedInstanceLinkAssessmentResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessments".equals(fieldName)) { + List assessments + = reader.readArray(reader1 -> SqlServerInstanceManagedInstanceLinkAssessment.fromJson(reader1)); + deserializedSqlServerInstanceManagedInstanceLinkAssessmentResponseInner.assessments = assessments; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceManagedInstanceLinkAssessmentResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceMigrationReadinessReportResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceMigrationReadinessReportResponseInner.java new file mode 100644 index 000000000000..66750758d705 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceMigrationReadinessReportResponseInner.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Represents the response containing the SQL Server Instance Migration Readiness report. + */ +@Immutable +public final class SqlServerInstanceMigrationReadinessReportResponseInner + implements JsonSerializable { + /* + * The migration readiness report as a serialized JSON string. When isCompressed is true, the value is + * base64-encoded GZip-compressed and must be decoded and decompressed before parsing. + */ + private String report; + + /* + * Indicates whether the report field contains base64-encoded GZip-compressed JSON. + */ + private Boolean isCompressed; + + /* + * The UTC timestamp in ISO 8601 format indicating when the migration readiness report was created. + */ + private OffsetDateTime createdTime; + + /** + * Creates an instance of SqlServerInstanceMigrationReadinessReportResponseInner class. + */ + private SqlServerInstanceMigrationReadinessReportResponseInner() { + } + + /** + * Get the report property: The migration readiness report as a serialized JSON string. When isCompressed is true, + * the value is base64-encoded GZip-compressed and must be decoded and decompressed before parsing. + * + * @return the report value. + */ + public String report() { + return this.report; + } + + /** + * Get the isCompressed property: Indicates whether the report field contains base64-encoded GZip-compressed JSON. + * + * @return the isCompressed value. + */ + public Boolean isCompressed() { + return this.isCompressed; + } + + /** + * Get the createdTime property: The UTC timestamp in ISO 8601 format indicating when the migration readiness report + * was created. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceMigrationReadinessReportResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceMigrationReadinessReportResponseInner if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceMigrationReadinessReportResponseInner. + */ + public static SqlServerInstanceMigrationReadinessReportResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceMigrationReadinessReportResponseInner deserializedSqlServerInstanceMigrationReadinessReportResponseInner + = new SqlServerInstanceMigrationReadinessReportResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("report".equals(fieldName)) { + deserializedSqlServerInstanceMigrationReadinessReportResponseInner.report = reader.getString(); + } else if ("isCompressed".equals(fieldName)) { + deserializedSqlServerInstanceMigrationReadinessReportResponseInner.isCompressed + = reader.getNullable(JsonReader::getBoolean); + } else if ("createdTime".equals(fieldName)) { + deserializedSqlServerInstanceMigrationReadinessReportResponseInner.createdTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceMigrationReadinessReportResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunBestPracticesAssessmentResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunBestPracticesAssessmentResponseInner.java new file mode 100644 index 000000000000..ae733d15f3e1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunBestPracticesAssessmentResponseInner.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import java.io.IOException; +import java.util.List; + +/** + * The response object for the request to run SQL best practices assessment. + */ +@Immutable +public final class SqlServerInstanceRunBestPracticesAssessmentResponseInner + implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceRunBestPracticesAssessmentResponseInner class. + */ + private SqlServerInstanceRunBestPracticesAssessmentResponseInner() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceRunBestPracticesAssessmentResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceRunBestPracticesAssessmentResponseInner if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SqlServerInstanceRunBestPracticesAssessmentResponseInner. + */ + public static SqlServerInstanceRunBestPracticesAssessmentResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceRunBestPracticesAssessmentResponseInner deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner + = new SqlServerInstanceRunBestPracticesAssessmentResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner.instanceName + = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner.jobStatus + = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner.jobException + = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner.backgroundJob + = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner.sequencerActions + = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceRunBestPracticesAssessmentResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java new file mode 100644 index 000000000000..e92ea829e3a5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import java.io.IOException; +import java.util.List; + +/** + * The response for running migration assessment on the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceRunMigrationAssessmentResponseInner + implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceRunMigrationAssessmentResponseInner class. + */ + private SqlServerInstanceRunMigrationAssessmentResponseInner() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceRunMigrationAssessmentResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceRunMigrationAssessmentResponseInner if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceRunMigrationAssessmentResponseInner. + */ + public static SqlServerInstanceRunMigrationAssessmentResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceRunMigrationAssessmentResponseInner deserializedSqlServerInstanceRunMigrationAssessmentResponseInner + = new SqlServerInstanceRunMigrationAssessmentResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.instanceName = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.jobStatus + = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.jobException = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.backgroundJob + = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceRunMigrationAssessmentResponseInner.sequencerActions + = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceRunMigrationAssessmentResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.java new file mode 100644 index 000000000000..58da478375c5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import java.io.IOException; +import java.util.List; + +/** + * The response object for the request to run migration readiness assessment. + */ +@Immutable +public final class SqlServerInstanceRunMigrationReadinessAssessmentResponseInner + implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceRunMigrationReadinessAssessmentResponseInner class. + */ + private SqlServerInstanceRunMigrationReadinessAssessmentResponseInner() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceRunMigrationReadinessAssessmentResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceRunMigrationReadinessAssessmentResponseInner if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SqlServerInstanceRunMigrationReadinessAssessmentResponseInner. + */ + public static SqlServerInstanceRunMigrationReadinessAssessmentResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner + = new SqlServerInstanceRunMigrationReadinessAssessmentResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner.instanceName + = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner.jobStatus + = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner.jobException + = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner.backgroundJob + = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner.sequencerActions + = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceRunMigrationReadinessAssessmentResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunTargetRecommendationJobResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunTargetRecommendationJobResponseInner.java new file mode 100644 index 000000000000..d1919e76f397 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunTargetRecommendationJobResponseInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import java.io.IOException; + +/** + * Represents the response of a SQL Server Instance target recommendation job execution. + */ +@Immutable +public final class SqlServerInstanceRunTargetRecommendationJobResponseInner + implements JsonSerializable { + /* + * Represents the current status of the target recommendation job. + */ + private JobStatus jobStatus; + + /** + * Creates an instance of SqlServerInstanceRunTargetRecommendationJobResponseInner class. + */ + private SqlServerInstanceRunTargetRecommendationJobResponseInner() { + } + + /** + * Get the jobStatus property: Represents the current status of the target recommendation job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceRunTargetRecommendationJobResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceRunTargetRecommendationJobResponseInner if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SqlServerInstanceRunTargetRecommendationJobResponseInner. + */ + public static SqlServerInstanceRunTargetRecommendationJobResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceRunTargetRecommendationJobResponseInner deserializedSqlServerInstanceRunTargetRecommendationJobResponseInner + = new SqlServerInstanceRunTargetRecommendationJobResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceRunTargetRecommendationJobResponseInner.jobStatus + = JobStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceRunTargetRecommendationJobResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceTargetRecommendationReportsResponseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceTargetRecommendationReportsResponseInner.java new file mode 100644 index 000000000000..bcd06efa2967 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceTargetRecommendationReportsResponseInner.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReport; +import java.io.IOException; +import java.util.List; + +/** + * Represents the response containing SQL Server Instance target recommendation reports. + */ +@Immutable +public final class SqlServerInstanceTargetRecommendationReportsResponseInner + implements JsonSerializable { + /* + * Represents the status of the latest target recommendation job. Report records are returned only when the job + * status is Succeeded. + */ + private JobStatus jobStatus; + + /* + * A collection of target recommendation reports. Returned only when the job status is Succeeded. + */ + private List reports; + + /* + * The total number of target recommendation reports available for retrieval. Currently, only the latest report is + * returned, so this value is always 1. + */ + private Integer totalReportCount; + + /* + * The report offset to use in the next request along with nextSectionOffset to continue retrieving data. This value + * remains the same until all sections of the current report have been retrieved. Present only when there is more + * data to retrieve. When both nextReportOffset and nextSectionOffset are absent, all data has been returned. + */ + private Integer nextReportOffset; + + /* + * The section offset to use in the next request along with nextReportOffset to continue retrieving sections of the + * current report. Present only when there is more data to retrieve. When both nextReportOffset and + * nextSectionOffset are absent, all data has been returned. + */ + private Integer nextSectionOffset; + + /** + * Creates an instance of SqlServerInstanceTargetRecommendationReportsResponseInner class. + */ + private SqlServerInstanceTargetRecommendationReportsResponseInner() { + } + + /** + * Get the jobStatus property: Represents the status of the latest target recommendation job. Report records are + * returned only when the job status is Succeeded. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Get the reports property: A collection of target recommendation reports. Returned only when the job status is + * Succeeded. + * + * @return the reports value. + */ + public List reports() { + return this.reports; + } + + /** + * Get the totalReportCount property: The total number of target recommendation reports available for retrieval. + * Currently, only the latest report is returned, so this value is always 1. + * + * @return the totalReportCount value. + */ + public Integer totalReportCount() { + return this.totalReportCount; + } + + /** + * Get the nextReportOffset property: The report offset to use in the next request along with nextSectionOffset to + * continue retrieving data. This value remains the same until all sections of the current report have been + * retrieved. Present only when there is more data to retrieve. When both nextReportOffset and nextSectionOffset are + * absent, all data has been returned. + * + * @return the nextReportOffset value. + */ + public Integer nextReportOffset() { + return this.nextReportOffset; + } + + /** + * Get the nextSectionOffset property: The section offset to use in the next request along with nextReportOffset to + * continue retrieving sections of the current report. Present only when there is more data to retrieve. When both + * nextReportOffset and nextSectionOffset are absent, all data has been returned. + * + * @return the nextSectionOffset value. + */ + public Integer nextSectionOffset() { + return this.nextSectionOffset; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTargetRecommendationReportsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTargetRecommendationReportsResponseInner if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SqlServerInstanceTargetRecommendationReportsResponseInner. + */ + public static SqlServerInstanceTargetRecommendationReportsResponseInner fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTargetRecommendationReportsResponseInner deserializedSqlServerInstanceTargetRecommendationReportsResponseInner + = new SqlServerInstanceTargetRecommendationReportsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsResponseInner.jobStatus + = JobStatus.fromString(reader.getString()); + } else if ("reports".equals(fieldName)) { + List reports + = reader.readArray(reader1 -> SqlServerInstanceTargetRecommendationReport.fromJson(reader1)); + deserializedSqlServerInstanceTargetRecommendationReportsResponseInner.reports = reports; + } else if ("totalReportCount".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsResponseInner.totalReportCount + = reader.getNullable(JsonReader::getInt); + } else if ("nextReportOffset".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsResponseInner.nextReportOffset + = reader.getNullable(JsonReader::getInt); + } else if ("nextSectionOffset".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsResponseInner.nextSectionOffset + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTargetRecommendationReportsResponseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java new file mode 100644 index 000000000000..c79848ba7feb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Describe SQL Server license resource. + */ +@Fluent +public final class SqlServerLicenseInner extends Resource { + /* + * SQL Server license properties + */ + private SqlServerLicenseProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SqlServerLicenseInner class. + */ + public SqlServerLicenseInner() { + } + + /** + * Get the properties property: SQL Server license properties. + * + * @return the properties value. + */ + public SqlServerLicenseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: SQL Server license properties. + * + * @param properties the properties value to set. + * @return the SqlServerLicenseInner object itself. + */ + public SqlServerLicenseInner withProperties(SqlServerLicenseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerLicenseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SqlServerLicenseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerLicenseInner. + */ + public static SqlServerLicenseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseInner deserializedSqlServerLicenseInner = new SqlServerLicenseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerLicenseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSqlServerLicenseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerLicenseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSqlServerLicenseInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerLicenseInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSqlServerLicenseInner.properties = SqlServerLicenseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSqlServerLicenseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseInner; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java index 2e89ec87247b..891245711cc1 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the inner data models for AzureArcDataManagementClient. + * Package containing the inner data models for AzureArcData. * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc * Resources. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java index da1de4780bf6..bc038b5bfd90 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the service clients for AzureArcDataManagementClient. + * Package containing the service clients for AzureArcData. * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc * Resources. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java new file mode 100644 index 000000000000..d327023678bb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorResource; + +public final class ActiveDirectoryConnectorResourceImpl + implements ActiveDirectoryConnectorResource, ActiveDirectoryConnectorResource.Definition { + private ActiveDirectoryConnectorResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + ActiveDirectoryConnectorResourceImpl(ActiveDirectoryConnectorResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ActiveDirectoryConnectorProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ActiveDirectoryConnectorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dataControllerName; + + private String activeDirectoryConnectorName; + + public ActiveDirectoryConnectorResourceImpl withExistingDataController(String resourceGroupName, + String dataControllerName) { + this.resourceGroupName = resourceGroupName; + this.dataControllerName = dataControllerName; + return this; + } + + public ActiveDirectoryConnectorResource create() { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .create(resourceGroupName, dataControllerName, activeDirectoryConnectorName, this.innerModel(), + Context.NONE); + return this; + } + + public ActiveDirectoryConnectorResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .create(resourceGroupName, dataControllerName, activeDirectoryConnectorName, this.innerModel(), context); + return this; + } + + ActiveDirectoryConnectorResourceImpl(String name, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new ActiveDirectoryConnectorResourceInner(); + this.serviceManager = serviceManager; + this.activeDirectoryConnectorName = name; + } + + public ActiveDirectoryConnectorResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE) + .getValue(); + return this; + } + + public ActiveDirectoryConnectorResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getActiveDirectoryConnectors() + .getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context) + .getValue(); + return this; + } + + public ActiveDirectoryConnectorResourceImpl withProperties(ActiveDirectoryConnectorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java new file mode 100644 index 000000000000..e46a5b1ca33e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java @@ -0,0 +1,803 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.ActiveDirectoryConnectorListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ActiveDirectoryConnectorsClient. + */ +public final class ActiveDirectoryConnectorsClientImpl implements ActiveDirectoryConnectorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ActiveDirectoryConnectorsService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of ActiveDirectoryConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ActiveDirectoryConnectorsClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(ActiveDirectoryConnectorsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientActiveDirectoryConnectors to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientActiveDirectoryConnectors") + public interface ActiveDirectoryConnectorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, + @PathParam("activeDirectoryConnectorName") String activeDirectoryConnectorName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + return getWithResponseAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, activeDirectoryConnectorName, accept, context); + } + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryConnectorResourceInner get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + return getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE) + .getValue(); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + contentType, accept, activeDirectoryConnectorResource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + contentType, accept, activeDirectoryConnectorResource, Context.NONE); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + contentType, accept, activeDirectoryConnectorResource, context); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ActiveDirectoryConnectorResourceInner> + beginCreateAsync(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + Mono>> mono = createWithResponseAsync(resourceGroupName, dataControllerName, + activeDirectoryConnectorName, activeDirectoryConnectorResource); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ActiveDirectoryConnectorResourceInner.class, + ActiveDirectoryConnectorResourceInner.class, this.client.getContext()); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActiveDirectoryConnectorResourceInner> + beginCreate(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + Response response = createWithResponse(resourceGroupName, dataControllerName, + activeDirectoryConnectorName, activeDirectoryConnectorResource); + return this.client.getLroResult( + response, ActiveDirectoryConnectorResourceInner.class, ActiveDirectoryConnectorResourceInner.class, + Context.NONE); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActiveDirectoryConnectorResourceInner> + beginCreate(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, Context context) { + Response response = createWithResponse(resourceGroupName, dataControllerName, + activeDirectoryConnectorName, activeDirectoryConnectorResource, context); + return this.client.getLroResult( + response, ActiveDirectoryConnectorResourceInner.class, ActiveDirectoryConnectorResourceInner.class, + context); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + return beginCreateAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource) { + return beginCreate(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource).getFinalResult(); + } + + /** + * Creates or replaces an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param activeDirectoryConnectorResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActiveDirectoryConnectorResourceInner create(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, ActiveDirectoryConnectorResourceInner activeDirectoryConnectorResource, + Context context) { + return beginCreate(resourceGroupName, dataControllerName, activeDirectoryConnectorName, + activeDirectoryConnectorResource, context).getFinalResult(); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + Context.NONE); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, activeDirectoryConnectorName, + context); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + Response response + = deleteWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + return beginDeleteAsync(resourceGroupName, dataControllerName, activeDirectoryConnectorName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName) { + beginDelete(resourceGroupName, dataControllerName, activeDirectoryConnectorName).getFinalResult(); + } + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + Context context) { + beginDelete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context).getFinalResult(); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String dataControllerName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String dataControllerName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, dataControllerName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String dataControllerName) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String dataControllerName, Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, dataControllerName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String dataControllerName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, dataControllerName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String dataControllerName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, dataControllerName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the active directory connectors associated with the given data controller. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java new file mode 100644 index 000000000000..301644890227 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorResource; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectors; + +public final class ActiveDirectoryConnectorsImpl implements ActiveDirectoryConnectors { + private static final ClientLogger LOGGER = new ClientLogger(ActiveDirectoryConnectorsImpl.class); + + private final ActiveDirectoryConnectorsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public ActiveDirectoryConnectorsImpl(ActiveDirectoryConnectorsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, + String dataControllerName, String activeDirectoryConnectorName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ActiveDirectoryConnectorResourceImpl(inner.getValue(), this.manager())); + } + + public ActiveDirectoryConnectorResource get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName) { + ActiveDirectoryConnectorResourceInner inner + = this.serviceClient().get(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + if (inner != null) { + return new ActiveDirectoryConnectorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName) { + this.serviceClient().delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName); + } + + public void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + Context context) { + this.serviceClient().delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + } + + public PagedIterable list(String resourceGroupName, String dataControllerName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, dataControllerName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ActiveDirectoryConnectorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String dataControllerName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, dataControllerName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ActiveDirectoryConnectorResourceImpl(inner1, this.manager())); + } + + public ActiveDirectoryConnectorResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + return this.getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + return this.getWithResponse(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + this.delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataControllerName = ResourceManagerUtils.getValueFromIdByName(id, "dataControllers"); + if (dataControllerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dataControllers'.", id))); + } + String activeDirectoryConnectorName + = ResourceManagerUtils.getValueFromIdByName(id, "activeDirectoryConnectors"); + if (activeDirectoryConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'activeDirectoryConnectors'.", id))); + } + this.delete(resourceGroupName, dataControllerName, activeDirectoryConnectorName, context); + } + + private ActiveDirectoryConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public ActiveDirectoryConnectorResourceImpl define(String name) { + return new ActiveDirectoryConnectorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java index cd4bf41f0178..d03d5084c070 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -20,34 +20,34 @@ @ServiceClientBuilder(serviceClients = { AzureArcDataManagementClientImpl.class }) public final class AzureArcDataManagementClientBuilder { /* - * The ID of the Azure subscription + * Service host */ - private String subscriptionId; + private String endpoint; /** - * Sets The ID of the Azure subscription. + * Sets Service host. * - * @param subscriptionId the subscriptionId value. + * @param endpoint the endpoint value. * @return the AzureArcDataManagementClientBuilder. */ - public AzureArcDataManagementClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; + public AzureArcDataManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } /* - * server parameter + * The ID of the target subscription. The value must be an UUID. */ - private String endpoint; + private String subscriptionId; /** - * Sets server parameter. + * Sets The ID of the target subscription. The value must be an UUID. * - * @param endpoint the endpoint value. + * @param subscriptionId the subscriptionId value. * @return the AzureArcDataManagementClientBuilder. */ - public AzureArcDataManagementClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + public AzureArcDataManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; return this; } @@ -132,7 +132,7 @@ public AzureArcDataManagementClientImpl buildClient() { ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); AzureArcDataManagementClientImpl client = new AzureArcDataManagementClientImpl(localPipeline, - localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); return client; } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java index 9bbd53adb59f..95ba98ed5c39 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -15,19 +15,29 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient; import com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient; import com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient; +import com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient; import com.azure.resourcemanager.azurearcdata.fluent.OperationsClient; +import com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -43,26 +53,12 @@ @ServiceClient(builder = AzureArcDataManagementClientBuilder.class) public final class AzureArcDataManagementClientImpl implements AzureArcDataManagementClient { /** - * The ID of the Azure subscription. - */ - private final String subscriptionId; - - /** - * Gets The ID of the Azure subscription. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * server parameter. + * Service host. */ private final String endpoint; /** - * Gets server parameter. + * Gets Service host. * * @return the endpoint value. */ @@ -71,12 +67,12 @@ public String getEndpoint() { } /** - * Api Version. + * Version parameter. */ private final String apiVersion; /** - * Gets Api Version. + * Gets Version parameter. * * @return the apiVersion value. */ @@ -84,6 +80,20 @@ public String getApiVersion() { return this.apiVersion; } + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + /** * The HTTP pipeline to send requests through. */ @@ -168,6 +178,76 @@ public SqlServerInstancesClient getSqlServerInstances() { return this.sqlServerInstances; } + /** + * The SqlServerLicensesClient object to access its operations. + */ + private final SqlServerLicensesClient sqlServerLicenses; + + /** + * Gets the SqlServerLicensesClient object to access its operations. + * + * @return the SqlServerLicensesClient object. + */ + public SqlServerLicensesClient getSqlServerLicenses() { + return this.sqlServerLicenses; + } + + /** + * The PostgresInstancesClient object to access its operations. + */ + private final PostgresInstancesClient postgresInstances; + + /** + * Gets the PostgresInstancesClient object to access its operations. + * + * @return the PostgresInstancesClient object. + */ + public PostgresInstancesClient getPostgresInstances() { + return this.postgresInstances; + } + + /** + * The SqlServerEsuLicensesClient object to access its operations. + */ + private final SqlServerEsuLicensesClient sqlServerEsuLicenses; + + /** + * Gets the SqlServerEsuLicensesClient object to access its operations. + * + * @return the SqlServerEsuLicensesClient object. + */ + public SqlServerEsuLicensesClient getSqlServerEsuLicenses() { + return this.sqlServerEsuLicenses; + } + + /** + * The FailoverGroupsClient object to access its operations. + */ + private final FailoverGroupsClient failoverGroups; + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + public FailoverGroupsClient getFailoverGroups() { + return this.failoverGroups; + } + + /** + * The SqlServerAvailabilityGroupsClient object to access its operations. + */ + private final SqlServerAvailabilityGroupsClient sqlServerAvailabilityGroups; + + /** + * Gets the SqlServerAvailabilityGroupsClient object to access its operations. + * + * @return the SqlServerAvailabilityGroupsClient object. + */ + public SqlServerAvailabilityGroupsClient getSqlServerAvailabilityGroups() { + return this.sqlServerAvailabilityGroups; + } + /** * The DataControllersClient object to access its operations. */ @@ -182,6 +262,34 @@ public DataControllersClient getDataControllers() { return this.dataControllers; } + /** + * The ActiveDirectoryConnectorsClient object to access its operations. + */ + private final ActiveDirectoryConnectorsClient activeDirectoryConnectors; + + /** + * Gets the ActiveDirectoryConnectorsClient object to access its operations. + * + * @return the ActiveDirectoryConnectorsClient object. + */ + public ActiveDirectoryConnectorsClient getActiveDirectoryConnectors() { + return this.activeDirectoryConnectors; + } + + /** + * The SqlServerDatabasesClient object to access its operations. + */ + private final SqlServerDatabasesClient sqlServerDatabases; + + /** + * Gets the SqlServerDatabasesClient object to access its operations. + * + * @return the SqlServerDatabasesClient object. + */ + public SqlServerDatabasesClient getSqlServerDatabases() { + return this.sqlServerDatabases; + } + /** * Initializes an instance of AzureArcDataManagementClient client. * @@ -189,21 +297,28 @@ public DataControllersClient getDataControllers() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId The ID of the Azure subscription. - * @param endpoint server parameter. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ AzureArcDataManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; - this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-08-01"; + this.subscriptionId = subscriptionId; + this.apiVersion = "2026-03-01-preview"; this.operations = new OperationsClientImpl(this); this.sqlManagedInstances = new SqlManagedInstancesClientImpl(this); this.sqlServerInstances = new SqlServerInstancesClientImpl(this); + this.sqlServerLicenses = new SqlServerLicensesClientImpl(this); + this.postgresInstances = new PostgresInstancesClientImpl(this); + this.sqlServerEsuLicenses = new SqlServerEsuLicensesClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); + this.sqlServerAvailabilityGroups = new SqlServerAvailabilityGroupsClientImpl(this); this.dataControllers = new DataControllersClientImpl(this); + this.activeDirectoryConnectors = new ActiveDirectoryConnectorsClientImpl(this); + this.sqlServerDatabases = new SqlServerDatabasesClientImpl(this); } /** @@ -243,6 +358,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * @@ -300,7 +432,7 @@ private static final class HttpResponseImpl extends HttpResponse { super(null); this.statusCode = statusCode; this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + this.responseBody = responseBody == null ? new byte[0] : responseBody.getBytes(StandardCharsets.UTF_8); } public int getStatusCode() { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java index 1666e1b558a1..52f12ec7a6c7 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -46,14 +46,14 @@ public Map tags() { } } - public ExtendedLocation extendedLocation() { - return this.innerModel().extendedLocation(); - } - public DataControllerProperties properties() { return this.innerModel().properties(); } + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + public SystemData systemData() { return this.innerModel().systemData(); } @@ -117,18 +117,14 @@ public DataControllerResourceImpl update() { public DataControllerResource apply() { this.innerObject = serviceManager.serviceClient() .getDataControllers() - .patchDataControllerWithResponse(resourceGroupName, dataControllerName, updateDataControllerResource, - Context.NONE) - .getValue(); + .patchDataController(resourceGroupName, dataControllerName, updateDataControllerResource, Context.NONE); return this; } public DataControllerResource apply(Context context) { this.innerObject = serviceManager.serviceClient() .getDataControllers() - .patchDataControllerWithResponse(resourceGroupName, dataControllerName, updateDataControllerResource, - context) - .getValue(); + .patchDataController(resourceGroupName, dataControllerName, updateDataControllerResource, context); return this; } @@ -167,8 +163,13 @@ public DataControllerResourceImpl withRegion(String location) { } public DataControllerResourceImpl withProperties(DataControllerProperties properties) { - this.innerModel().withProperties(properties); - return this; + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateDataControllerResource.withProperties(properties); + return this; + } } public DataControllerResourceImpl withTags(Map tags) { @@ -187,6 +188,6 @@ public DataControllerResourceImpl withExtendedLocation(ExtendedLocation extended } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java index a523ec0d8ac5..d9d1359773b7 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -28,14 +28,15 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient; import com.azure.resourcemanager.azurearcdata.fluent.models.DataControllerResourceInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.PageOfDataControllerResource; import com.azure.resourcemanager.azurearcdata.models.DataControllerUpdate; -import com.azure.resourcemanager.azurearcdata.models.PageOfDataControllerResource; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -69,66 +70,135 @@ public final class DataControllersClientImpl implements DataControllersClient { * The interface defining all the services for AzureArcDataManagementClientDataControllers to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AzureArcDataManageme") + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientDataControllers") public interface DataControllersService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Accept") String accept, + Context context); - @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> putDataController(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono>> putDataController(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") DataControllerResourceInner dataControllerResource, - @HeaderParam("Accept") String accept, Context context); + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") DataControllerResourceInner dataControllerResource, Context context); - @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response putDataControllerSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") DataControllerResourceInner dataControllerResource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> patchDataController(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") DataControllerUpdate dataControllerResource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response patchDataControllerSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") DataControllerUpdate dataControllerResource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, + @PathParam("dataControllerName") String dataControllerName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataControllerName") String dataControllerName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}") + @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> patchDataController(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("dataControllerName") String dataControllerName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") DataControllerUpdate dataControllerResource, + Mono> listInGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listInGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -136,369 +206,345 @@ Mono> patchDataController(@HostParam("$hos @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listInSubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listInGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Response listInSubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String dataControllerName) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + private Mono getByResourceGroupAsync(String resourceGroupName, + String dataControllerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dataControllerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return data controller resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listInSubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String dataControllerName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, accept, context); } /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return data controller resource. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listInSubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public DataControllerResourceInner getByResourceGroup(String resourceGroupName, String dataControllerName) { + return getByResourceGroupWithResponse(resourceGroupName, dataControllerName, Context.NONE).getValue(); } /** - * List dataController resources in the subscription. + * Creates or replaces a dataController resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> putDataControllerWithResponseAsync(String resourceGroupName, + String dataControllerName, DataControllerResourceInner dataControllerResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.putDataController(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, contentType, accept, + dataControllerResource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List dataController resources in the subscription. + * Creates or replaces a dataController resource. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response putDataControllerWithResponse(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putDataControllerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, contentType, accept, + dataControllerResource, Context.NONE); } /** - * List dataController resources in the resource group. + * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return data controller resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } + private Response putDataControllerWithResponse(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource, Context context) { + final String contentType = "application/json"; final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + return service.putDataControllerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, contentType, accept, + dataControllerResource, context); } /** - * List dataController resources in the resource group. + * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of data controller resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DataControllerResourceInner> + beginPutDataControllerAsync(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource) { + Mono>> mono + = putDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, + this.client.getContext()); } /** - * List dataController resources in the resource group. + * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return the {@link SyncPoller} for polling of data controller resource. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listInGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataControllerResourceInner> beginPutDataController( + String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { + Response response + = putDataControllerWithResponse(resourceGroupName, dataControllerName, dataControllerResource); + return this.client.getLroResult(response, + DataControllerResourceInner.class, DataControllerResourceInner.class, Context.NONE); } /** - * List dataController resources in the resource group. + * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. + * @return the {@link SyncPoller} for polling of data controller resource. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listInGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DataControllerResourceInner> beginPutDataController( + String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource, + Context context) { + Response response + = putDataControllerWithResponse(resourceGroupName, dataControllerName, dataControllerResource, context); + return this.client.getLroResult(response, + DataControllerResourceInner.class, DataControllerResourceInner.class, context); } /** - * List dataController resources in the resource group. + * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putDataControllerAsync(String resourceGroupName, + String dataControllerName, DataControllerResourceInner dataControllerResource) { + return beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * List dataController resources in the resource group. + * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource desc. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource) { + return beginPutDataController(resourceGroupName, dataControllerName, dataControllerResource).getFinalResult(); } /** * Creates or replaces a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param dataControllerResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return data controller resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, + DataControllerResourceInner dataControllerResource, Context context) { + return beginPutDataController(resourceGroupName, dataControllerName, dataControllerResource, context) + .getFinalResult(); + } + + /** + * Updates a dataController resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putDataControllerWithResponseAsync(String resourceGroupName, - String dataControllerName, DataControllerResourceInner dataControllerResource) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - if (dataControllerResource == null) { - return Mono.error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); - } else { - dataControllerResource.validate(); - } + private Mono>> patchDataControllerWithResponseAsync(String resourceGroupName, + String dataControllerName, DataControllerUpdate dataControllerResource) { + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.putDataController(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, dataControllerName, this.client.getApiVersion(), - dataControllerResource, accept, context)) + .withContext(context -> service.patchDataController(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, contentType, accept, + dataControllerResource, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. + * @return data controller resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putDataControllerWithResponseAsync(String resourceGroupName, - String dataControllerName, DataControllerResourceInner dataControllerResource, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - if (dataControllerResource == null) { - return Mono.error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); - } else { - dataControllerResource.validate(); - } + private Response patchDataControllerWithResponse(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource) { + final String contentType = "application/json"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.putDataController(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - dataControllerName, this.client.getApiVersion(), dataControllerResource, accept, context); + return service.patchDataControllerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, contentType, accept, + dataControllerResource, Context.NONE); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of data controller resource. + * @return data controller resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DataControllerResourceInner> - beginPutDataControllerAsync(String resourceGroupName, String dataControllerName, - DataControllerResourceInner dataControllerResource) { - Mono>> mono - = putDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response patchDataControllerWithResponse(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.patchDataControllerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, contentType, accept, + dataControllerResource, context); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -506,40 +552,41 @@ private Mono>> putDataControllerWithResponseAsync(Stri */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DataControllerResourceInner> - beginPutDataControllerAsync(String resourceGroupName, String dataControllerName, - DataControllerResourceInner dataControllerResource, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = putDataControllerWithResponseAsync(resourceGroupName, - dataControllerName, dataControllerResource, context); + beginPatchDataControllerAsync(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource) { + Mono>> mono + = patchDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource); return this.client.getLroResult(mono, this.client.getHttpPipeline(), DataControllerResourceInner.class, DataControllerResourceInner.class, - context); + this.client.getContext()); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of data controller resource. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, DataControllerResourceInner> beginPutDataController( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource) { - return this.beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource) - .getSyncPoller(); + public SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource) { + Response response + = patchDataControllerWithResponse(resourceGroupName, dataControllerName, dataControllerResource); + return this.client.getLroResult(response, + DataControllerResourceInner.class, DataControllerResourceInner.class, Context.NONE); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -547,74 +594,56 @@ public SyncPoller, DataControllerResourc * @return the {@link SyncPoller} for polling of data controller resource. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, DataControllerResourceInner> beginPutDataController( - String resourceGroupName, String dataControllerName, DataControllerResourceInner dataControllerResource, + public SyncPoller, DataControllerResourceInner> beginPatchDataController( + String resourceGroupName, String dataControllerName, DataControllerUpdate dataControllerResource, Context context) { - return this.beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) - .getSyncPoller(); - } - - /** - * Creates or replaces a dataController resource. - * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putDataControllerAsync(String resourceGroupName, - String dataControllerName, DataControllerResourceInner dataControllerResource) { - return beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).last() - .flatMap(this.client::getLroFinalResultOrError); + Response response + = patchDataControllerWithResponse(resourceGroupName, dataControllerName, dataControllerResource, context); + return this.client.getLroResult(response, + DataControllerResourceInner.class, DataControllerResourceInner.class, context); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data controller resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putDataControllerAsync(String resourceGroupName, - String dataControllerName, DataControllerResourceInner dataControllerResource, Context context) { - return beginPutDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context) - .last() + private Mono patchDataControllerAsync(String resourceGroupName, + String dataControllerName, DataControllerUpdate dataControllerResource) { + return beginPatchDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, - DataControllerResourceInner dataControllerResource) { - return putDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource).block(); + public DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource) { + return beginPatchDataController(resourceGroupName, dataControllerName, dataControllerResource).getFinalResult(); } /** - * Creates or replaces a dataController resource. + * Updates a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource desc. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param dataControllerResource The update data controller resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -622,16 +651,17 @@ public DataControllerResourceInner putDataController(String resourceGroupName, S * @return data controller resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner putDataController(String resourceGroupName, String dataControllerName, - DataControllerResourceInner dataControllerResource, Context context) { - return putDataControllerAsync(resourceGroupName, dataControllerName, dataControllerResource, context).block(); + public DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, + DataControllerUpdate dataControllerResource, Context context) { + return beginPatchDataController(resourceGroupName, dataControllerName, dataControllerResource, context) + .getFinalResult(); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -640,107 +670,68 @@ public DataControllerResourceInner putDataController(String resourceGroupName, S @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync(String resourceGroupName, String dataControllerName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, dataControllerName, this.client.getApiVersion(), accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, - String dataControllerName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - dataControllerName, this.client.getApiVersion(), accept, context); + private Response deleteWithResponse(String resourceGroupName, String dataControllerName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, Context.NONE); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String dataControllerName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, dataControllerName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String dataControllerName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, dataControllerName, context); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String dataControllerName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = deleteWithResponseAsync(resourceGroupName, dataControllerName, context); + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String dataControllerName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, dataControllerName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -748,14 +739,15 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName) { - return this.beginDeleteAsync(resourceGroupName, dataControllerName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, dataControllerName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -765,14 +757,15 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String dataControllerName, Context context) { - return this.beginDeleteAsync(resourceGroupName, dataControllerName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, dataControllerName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -787,342 +780,273 @@ private Mono deleteAsync(String resourceGroupName, String dataControllerNa /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String dataControllerName, Context context) { - return beginDeleteAsync(resourceGroupName, dataControllerName, context).last() - .flatMap(this.client::getLroFinalResultOrError); + public void delete(String resourceGroupName, String dataControllerName) { + beginDelete(resourceGroupName, dataControllerName).getFinalResult(); } /** * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String dataControllerName) { - deleteAsync(resourceGroupName, dataControllerName).block(); + public void delete(String resourceGroupName, String dataControllerName, Context context) { + beginDelete(resourceGroupName, dataControllerName, context).getFinalResult(); } /** - * Deletes a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String dataControllerName, Context context) { - deleteAsync(resourceGroupName, dataControllerName, context).block(); + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. + * @return a list of data controllers as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String dataControllerName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, dataControllerName, this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listInGroupNextSinglePageAsync(nextLink)); } /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String dataControllerName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - dataControllerName, this.client.getApiVersion(), accept, context); + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, - String dataControllerName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, dataControllerName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String dataControllerName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, dataControllerName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listInGroupNextSinglePage(nextLink)); } /** - * Retrieves a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner getByResourceGroup(String resourceGroupName, String dataControllerName) { - return getByResourceGroupWithResponse(resourceGroupName, dataControllerName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listInGroupNextSinglePage(nextLink, context)); } /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchDataControllerWithResponseAsync(String resourceGroupName, - String dataControllerName, DataControllerUpdate dataControllerResource) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - if (dataControllerResource == null) { - return Mono.error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); - } else { - dataControllerResource.validate(); - } + private Mono> listSinglePageAsync() { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.patchDataController(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, dataControllerName, this.client.getApiVersion(), - dataControllerResource, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response} on successful completion of {@link Mono}. + * @return a list of data controllers as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchDataControllerWithResponseAsync(String resourceGroupName, - String dataControllerName, DataControllerUpdate dataControllerResource, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (dataControllerName == null) { - return Mono - .error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null.")); - } - if (dataControllerResource == null) { - return Mono.error( - new IllegalArgumentException("Parameter dataControllerResource is required and cannot be null.")); - } else { - dataControllerResource.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.patchDataController(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, dataControllerName, this.client.getApiVersion(), dataControllerResource, accept, - context); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listInSubscriptionNextSinglePageAsync(nextLink)); } /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono patchDataControllerAsync(String resourceGroupName, - String dataControllerName, DataControllerUpdate dataControllerResource) { - return patchDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response}. + * @return a list of data controllers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchDataControllerWithResponse(String resourceGroupName, - String dataControllerName, DataControllerUpdate dataControllerResource, Context context) { - return patchDataControllerWithResponseAsync(resourceGroupName, dataControllerName, dataControllerResource, - context).block(); + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Updates a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param dataControllerResource The update data controller resource. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of data controllers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listInSubscriptionNextSinglePage(nextLink)); + } + + /** + * List dataController resources in the subscription. + * + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DataControllerResourceInner patchDataController(String resourceGroupName, String dataControllerName, - DataControllerUpdate dataControllerResource) { - return patchDataControllerWithResponse(resourceGroupName, dataControllerName, dataControllerResource, - Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listInSubscriptionNextSinglePage(nextLink, context)); } /** + * List dataController resources in the resource group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listInSubscriptionNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private Mono> listInGroupNextSinglePageAsync(String nextLink) { final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.listInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .withContext(context -> service.listInGroupNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** + * List dataController resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of data controllers along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listInGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listInGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List dataController resources in the resource group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1130,52 +1054,62 @@ private Mono> listInSubscriptionNextS * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listInSubscriptionNextSinglePageAsync(String nextLink, - Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private PagedResponse listInGroupNextSinglePage(String nextLink, Context context) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listInGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** + * List dataController resources in the subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listInGroupNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private Mono> listInSubscriptionNextSinglePageAsync(String nextLink) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listInGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .withContext( + context -> service.listInSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** + * List dataController resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of data controllers along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listInSubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listInSubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List dataController resources in the subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1183,22 +1117,15 @@ private Mono> listInGroupNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of data controllers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listInGroupNextSinglePageAsync(String nextLink, + private PagedResponse listInSubscriptionNextSinglePage(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listInGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listInSubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java index 03af68dfaa61..61ff0cb35c3b 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -27,14 +27,30 @@ public DataControllersImpl(DataControllersClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); + public Response getByResourceGroupWithResponse(String resourceGroupName, + String dataControllerName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DataControllerResourceImpl(inner.getValue(), this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); + public DataControllerResource getByResourceGroup(String resourceGroupName, String dataControllerName) { + DataControllerResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, dataControllerName); + if (inner != null) { + return new DataControllerResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String dataControllerName) { + this.serviceClient().delete(resourceGroupName, dataControllerName); + } + + public void delete(String resourceGroupName, String dataControllerName, Context context) { + this.serviceClient().delete(resourceGroupName, dataControllerName, context); } public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -48,34 +64,14 @@ public PagedIterable listByResourceGroup(String resource return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } - public void deleteByResourceGroup(String resourceGroupName, String dataControllerName) { - this.serviceClient().delete(resourceGroupName, dataControllerName); - } - - public void delete(String resourceGroupName, String dataControllerName, Context context) { - this.serviceClient().delete(resourceGroupName, dataControllerName, context); - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String dataControllerName, Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dataControllerName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new DataControllerResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } - public DataControllerResource getByResourceGroup(String resourceGroupName, String dataControllerName) { - DataControllerResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, dataControllerName); - if (inner != null) { - return new DataControllerResourceImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DataControllerResourceImpl(inner1, this.manager())); } public DataControllerResource getById(String id) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java new file mode 100644 index 000000000000..26bdbe8d7b61 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; + +public final class FailoverGroupResourceImpl implements FailoverGroupResource, FailoverGroupResource.Definition { + private FailoverGroupResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + FailoverGroupResourceImpl(FailoverGroupResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public FailoverGroupProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public FailoverGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlManagedInstanceName; + + private String failoverGroupName; + + public FailoverGroupResourceImpl withExistingSqlManagedInstance(String resourceGroupName, + String sqlManagedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlManagedInstanceName = sqlManagedInstanceName; + return this; + } + + public FailoverGroupResource create() { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .create(resourceGroupName, sqlManagedInstanceName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public FailoverGroupResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .create(resourceGroupName, sqlManagedInstanceName, failoverGroupName, this.innerModel(), context); + return this; + } + + FailoverGroupResourceImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new FailoverGroupResourceInner(); + this.serviceManager = serviceManager; + this.failoverGroupName = name; + } + + public FailoverGroupResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE) + .getValue(); + return this; + } + + public FailoverGroupResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context) + .getValue(); + return this; + } + + public FailoverGroupResourceImpl withProperties(FailoverGroupProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java new file mode 100644 index 000000000000..e8743922195e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java @@ -0,0 +1,785 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.FailoverGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FailoverGroupsClient. + */ +public final class FailoverGroupsClientImpl implements FailoverGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final FailoverGroupsService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of FailoverGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FailoverGroupsClientImpl(AzureArcDataManagementClientImpl client) { + this.service + = RestProxy.create(FailoverGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientFailoverGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientFailoverGroups") + public interface FailoverGroupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") FailoverGroupResourceInner failoverGroupResource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") FailoverGroupResourceInner failoverGroupResource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, + @PathParam("failoverGroupName") String failoverGroupName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + return getWithResponseAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlManagedInstanceName, failoverGroupName, accept, context); + } + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupResourceInner get(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + return getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, + contentType, accept, failoverGroupResource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, contentType, + accept, failoverGroupResource, Context.NONE); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, contentType, + accept, failoverGroupResource, context); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupResourceInner> beginCreateAsync( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource) { + Mono>> mono = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, + failoverGroupName, failoverGroupResource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), FailoverGroupResourceInner.class, FailoverGroupResourceInner.class, + this.client.getContext()); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupResourceInner> beginCreate( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource) { + Response response + = createWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource); + return this.client.getLroResult(response, + FailoverGroupResourceInner.class, FailoverGroupResourceInner.class, Context.NONE); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupResourceInner> beginCreate( + String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + FailoverGroupResourceInner failoverGroupResource, Context context) { + Response response = createWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, + failoverGroupResource, context); + return this.client.getLroResult(response, + FailoverGroupResourceInner.class, FailoverGroupResourceInner.class, context); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource) { + return beginCreate(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource) + .getFinalResult(); + } + + /** + * Creates or replaces a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param failoverGroupResource desc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupResourceInner create(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, FailoverGroupResourceInner failoverGroupResource, Context context) { + return beginCreate(resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, context) + .getFinalResult(); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, String failoverGroupName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, + Context.NONE); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + Response response + = deleteWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, failoverGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName) { + beginDelete(resourceGroupName, sqlManagedInstanceName, failoverGroupName).getFinalResult(); + } + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + Context context) { + beginDelete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context).getFinalResult(); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlManagedInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String sqlManagedInstanceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlManagedInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String sqlManagedInstanceName) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String sqlManagedInstanceName, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, sqlManagedInstanceName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, sqlManagedInstanceName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the failover groups associated with the given sql managed instance. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java new file mode 100644 index 000000000000..091510f96525 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroups; + +public final class FailoverGroupsImpl implements FailoverGroups { + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupsImpl.class); + + private final FailoverGroupsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public FailoverGroupsImpl(FailoverGroupsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FailoverGroupResourceImpl(inner.getValue(), this.manager())); + } + + public FailoverGroupResource get(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName) { + FailoverGroupResourceInner inner + = this.serviceClient().get(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + if (inner != null) { + return new FailoverGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName) { + this.serviceClient().delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName); + } + + public void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, + Context context) { + this.serviceClient().delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlManagedInstanceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FailoverGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlManagedInstanceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FailoverGroupResourceImpl(inner1, this.manager())); + } + + public FailoverGroupResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlManagedInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlManagedInstances"); + if (sqlManagedInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlManagedInstances'.", id))); + } + String failoverGroupName = ResourceManagerUtils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, sqlManagedInstanceName, failoverGroupName, context); + } + + private FailoverGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public FailoverGroupResourceImpl define(String name) { + return new FailoverGroupResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java index f371a1f74871..7b6fb110b021 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java index 82715ad4c65c..353f36e99a71 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.azurearcdata.fluent.OperationsClient; import com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner; -import com.azure.resourcemanager.azurearcdata.models.OperationListResult; +import com.azure.resourcemanager.azurearcdata.implementation.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -59,14 +59,21 @@ public final class OperationsClientImpl implements OperationsClient { * The interface defining all the services for AzureArcDataManagementClientOperations to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AzureArcDataManageme") + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientOperations") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.AzureArcData/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.AzureArcData/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -74,7 +81,14 @@ Mono> list(@HostParam("$host") String endpoint, @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -87,10 +101,6 @@ Mono> listNext(@PathParam(value = "nextLink", enco */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( @@ -103,24 +113,14 @@ private Mono> listSinglePageAsync() { /** * Lists all of the available Azure Data Services on Azure Arc API operations. * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Azure Data Services on Azure Arc operations along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * @return result of the request to list Azure Data Services on Azure Arc operations as paginated response with + * {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -128,12 +128,16 @@ private Mono> listSinglePageAsync(Context context) * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedFlux}. + * @return result of the request to list Azure Data Services on Azure Arc operations along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -143,13 +147,16 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Azure Data Services on Azure Arc operations as paginated response with - * {@link PagedFlux}. + * @return result of the request to list Azure Data Services on Azure Arc operations along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -162,7 +169,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -177,7 +184,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -192,13 +199,6 @@ public PagedIterable list(Context context) { */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), @@ -206,6 +206,25 @@ private Mono> listNextSinglePageAsync(String nextL .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Azure Data Services on Azure Arc operations along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -215,21 +234,13 @@ private Mono> listNextSinglePageAsync(String nextL * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of the request to list Azure Data Services on Azure Arc operations along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private PagedResponse listNextSinglePage(String nextLink, Context context) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java index 88bda46dcd91..a88b6888918e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java new file mode 100644 index 000000000000..98790be47e32 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate; +import java.util.Collections; +import java.util.Map; + +public final class PostgresInstanceImpl + implements PostgresInstance, PostgresInstance.Definition, PostgresInstance.Update { + private PostgresInstanceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PostgresInstanceProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public PostgresInstanceSku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PostgresInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String postgresInstanceName; + + private PostgresInstanceUpdate updateParameters; + + public PostgresInstanceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PostgresInstance create() { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .create(resourceGroupName, postgresInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public PostgresInstance create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .create(resourceGroupName, postgresInstanceName, this.innerModel(), context); + return this; + } + + PostgresInstanceImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new PostgresInstanceInner(); + this.serviceManager = serviceManager; + this.postgresInstanceName = name; + } + + public PostgresInstanceImpl update() { + this.updateParameters = new PostgresInstanceUpdate(); + return this; + } + + public PostgresInstance apply() { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .updateWithResponse(resourceGroupName, postgresInstanceName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public PostgresInstance apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .updateWithResponse(resourceGroupName, postgresInstanceName, updateParameters, context) + .getValue(); + return this; + } + + PostgresInstanceImpl(PostgresInstanceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "postgresInstances"); + } + + public PostgresInstance refresh() { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, Context.NONE) + .getValue(); + return this; + } + + public PostgresInstance refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPostgresInstances() + .getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, context) + .getValue(); + return this; + } + + public PostgresInstanceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PostgresInstanceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PostgresInstanceImpl withProperties(PostgresInstanceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateParameters.withProperties(properties); + return this; + } + } + + public PostgresInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public PostgresInstanceImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public PostgresInstanceImpl withSku(PostgresInstanceSku sku) { + this.innerModel().withSku(sku); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java new file mode 100644 index 000000000000..f32c30193b97 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java @@ -0,0 +1,1028 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.PostgresInstanceListResult; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PostgresInstancesClient. + */ +public final class PostgresInstancesClientImpl implements PostgresInstancesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PostgresInstancesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of PostgresInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PostgresInstancesClientImpl(AzureArcDataManagementClientImpl client) { + this.service + = RestProxy.create(PostgresInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientPostgresInstances to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientPostgresInstances") + public interface PostgresInstancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PostgresInstanceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PostgresInstanceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PostgresInstanceUpdate parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PostgresInstanceUpdate parameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("postgresInstanceName") String postgresInstanceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/postgresInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/postgresInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String postgresInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String postgresInstanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, postgresInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String postgresInstanceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, accept, context); + } + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner getByResourceGroup(String resourceGroupName, String postgresInstanceName) { + return getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, contentType, accept, resource, + Context.NONE); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, contentType, accept, resource, + context); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PostgresInstanceInner> + beginCreateAsync(String resourceGroupName, String postgresInstanceName, PostgresInstanceInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, postgresInstanceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostgresInstanceInner.class, PostgresInstanceInner.class, + this.client.getContext()); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource) { + Response response = createWithResponse(resourceGroupName, postgresInstanceName, resource); + return this.client.getLroResult(response, + PostgresInstanceInner.class, PostgresInstanceInner.class, Context.NONE); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PostgresInstanceInner> beginCreate(String resourceGroupName, + String postgresInstanceName, PostgresInstanceInner resource, Context context) { + Response response = createWithResponse(resourceGroupName, postgresInstanceName, resource, context); + return this.client.getLroResult(response, + PostgresInstanceInner.class, PostgresInstanceInner.class, context); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource) { + return beginCreateAsync(resourceGroupName, postgresInstanceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource) { + return beginCreate(resourceGroupName, postgresInstanceName, resource).getFinalResult(); + } + + /** + * Creates or replaces a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param resource The postgres instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner create(String resourceGroupName, String postgresInstanceName, + PostgresInstanceInner resource, Context context) { + return beginCreate(resourceGroupName, postgresInstanceName, resource, context).getFinalResult(); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String postgresInstanceName, PostgresInstanceUpdate parameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, contentType, accept, + parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, postgresInstanceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, contentType, accept, parameters, + context); + } + + /** + * Updates a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param parameters The Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PostgresInstanceInner update(String resourceGroupName, String postgresInstanceName, + PostgresInstanceUpdate parameters) { + return updateWithResponse(resourceGroupName, postgresInstanceName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String postgresInstanceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String postgresInstanceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, Context.NONE); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String postgresInstanceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, postgresInstanceName, context); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String postgresInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, postgresInstanceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String postgresInstanceName) { + Response response = deleteWithResponse(resourceGroupName, postgresInstanceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String postgresInstanceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, postgresInstanceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String postgresInstanceName) { + return beginDeleteAsync(resourceGroupName, postgresInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String postgresInstanceName) { + beginDelete(resourceGroupName, postgresInstanceName).getFinalResult(); + } + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String postgresInstanceName, Context context) { + beginDelete(resourceGroupName, postgresInstanceName, context).getFinalResult(); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List postgres Instance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List postgres Instance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List postgres Instance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List postgres Instance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List postgres Instance resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List postgres Instance resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List postgres Instance resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List postgres Instance resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java new file mode 100644 index 000000000000..ba0c7b8942d7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstances; + +public final class PostgresInstancesImpl implements PostgresInstances { + private static final ClientLogger LOGGER = new ClientLogger(PostgresInstancesImpl.class); + + private final PostgresInstancesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public PostgresInstancesImpl(PostgresInstancesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String postgresInstanceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PostgresInstanceImpl(inner.getValue(), this.manager())); + } + + public PostgresInstance getByResourceGroup(String resourceGroupName, String postgresInstanceName) { + PostgresInstanceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, postgresInstanceName); + if (inner != null) { + return new PostgresInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String postgresInstanceName) { + this.serviceClient().delete(resourceGroupName, postgresInstanceName); + } + + public void delete(String resourceGroupName, String postgresInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, postgresInstanceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PostgresInstanceImpl(inner1, this.manager())); + } + + public PostgresInstance getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, postgresInstanceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + this.delete(resourceGroupName, postgresInstanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String postgresInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "postgresInstances"); + if (postgresInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'postgresInstances'.", id))); + } + this.delete(resourceGroupName, postgresInstanceName, context); + } + + private PostgresInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public PostgresInstanceImpl define(String name) { + return new PostgresInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java index a2c6f5fdb2a4..fc265cd20a24 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java index 406eed3fd89a..594157f87c9c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -196,6 +196,6 @@ public SqlManagedInstanceImpl withSku(SqlManagedInstanceSku sku) { } private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java index d9cf04dc35e8..19eb7fcc23fc 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -28,13 +28,14 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlManagedInstanceInner; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceListResult; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlManagedInstanceListResult; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceUpdate; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -69,76 +70,119 @@ public final class SqlManagedInstancesClientImpl implements SqlManagedInstancesC * The interface defining all the services for AzureArcDataManagementClientSqlManagedInstances to be used by the * proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AzureArcDataManageme") + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientSqlManagedInstances") public interface SqlManagedInstancesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, @HeaderParam("Accept") String accept, + Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") - @ExpectedResponses({ 200 }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlManagedInstanceInner sqlManagedInstance, Context context); - @Headers({ "Content-Type: application/json" }) @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> create(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlManagedInstanceInner sqlManagedInstance, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlManagedInstanceInner sqlManagedInstance, Context context); - @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") - @ExpectedResponses({ 200, 202, 204 }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlManagedInstanceUpdate parameters, Context context); - @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlManagedInstanceUpdate parameters, @HeaderParam("Accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlManagedInstanceUpdate parameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlManagedInstanceName") String sqlManagedInstanceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -146,261 +190,38 @@ Mono> listNext( @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * List sqlManagedInstance resources in the subscription. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List sqlManagedInstance resources in the subscription. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * List sqlManagedInstance resources in the subscription. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * List sqlManagedInstance resources in the subscription. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * List sqlManagedInstance resources in the subscription. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * List sqlManagedInstance resources in the subscription. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); - } - - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); - } + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); - } + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); - /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. - * - * @param resourceGroupName The name of the Azure resource group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** * Retrieves a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -410,70 +231,17 @@ public PagedIterable listByResourceGroup(String resourc @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String sqlManagedInstanceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), accept, context)) + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Retrieves a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of SQL Managed Instance. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String sqlManagedInstanceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlManagedInstanceName, this.client.getApiVersion(), accept, context); - } - - /** - * Retrieves a SQL Managed Instance resource. - * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -490,7 +258,7 @@ private Mono getByResourceGroupAsync(String resourceGro /** * Retrieves a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -501,13 +269,15 @@ private Mono getByResourceGroupAsync(String resourceGro @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse(String resourceGroupName, String sqlManagedInstanceName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, sqlManagedInstanceName, context).block(); + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, accept, context); } /** * Retrieves a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -522,8 +292,8 @@ public SqlManagedInstanceInner getByResourceGroup(String resourceGroupName, Stri /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -533,107 +303,64 @@ public SqlManagedInstanceInner getByResourceGroup(String resourceGroupName, Stri @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createWithResponseAsync(String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - if (sqlManagedInstance == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlManagedInstance is required and cannot be null.")); - } else { - sqlManagedInstance.validate(); - } + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlManagedInstanceName, this.client.getApiVersion(), sqlManagedInstance, accept, context)) + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, contentType, accept, + sqlManagedInstance, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. + * @return a SqlManagedInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, - String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - if (sqlManagedInstance == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlManagedInstance is required and cannot be null.")); - } else { - sqlManagedInstance.validate(); - } + private Response createWithResponse(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance) { + final String contentType = "application/json"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlManagedInstanceName, this.client.getApiVersion(), sqlManagedInstance, accept, context); + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, contentType, accept, + sqlManagedInstance, Context.NONE); } /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of a SqlManagedInstance. + * @return a SqlManagedInstance along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, SqlManagedInstanceInner> beginCreateAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { - Mono>> mono - = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, contentType, accept, + sqlManagedInstance, context); } /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -641,20 +368,19 @@ private PollerFlux, SqlManagedInstanceInner> */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlManagedInstanceInner> beginCreateAsync( - String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, - Context context) { - context = this.client.mergeContext(context); + String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { Mono>> mono - = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context); + = createWithResponseAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, context); + this.client.getHttpPipeline(), SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, + this.client.getContext()); } /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -664,14 +390,17 @@ private PollerFlux, SqlManagedInstanceInner> @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlManagedInstanceInner> beginCreate( String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance) { - return this.beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).getSyncPoller(); + Response response + = createWithResponse(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance); + return this.client.getLroResult(response, + SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, Context.NONE); } /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -683,15 +412,17 @@ public SyncPoller, SqlManagedInstanceInner> public SyncPoller, SqlManagedInstanceInner> beginCreate( String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context) { - return this.beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context) - .getSyncPoller(); + Response response + = createWithResponse(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context); + return this.client.getLroResult(response, + SqlManagedInstanceInner.class, SqlManagedInstanceInner.class, context); } /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -708,62 +439,123 @@ private Mono createAsync(String resourceGroupName, Stri /** * Creates or replaces a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param sqlManagedInstance The SQL Managed Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlManagedInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceInner sqlManagedInstance) { + return beginCreate(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).getFinalResult(); + } + + /** + * Creates or replaces a SQL Managed Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param sqlManagedInstance The SQL Managed Instance to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance on successful completion of {@link Mono}. + * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String sqlManagedInstanceName, + public SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, SqlManagedInstanceInner sqlManagedInstance, Context context) { - return beginCreateAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context).last() - .flatMap(this.client::getLroFinalResultOrError); + return beginCreate(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context).getFinalResult(); + } + + /** + * Updates a SQL Managed Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param parameters The SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, contentType, accept, + parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Managed Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param parameters The SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlManagedInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlManagedInstanceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Creates or replaces a SQL Managed Instance resource. + * Updates a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. - * @param sqlManagedInstance The SQL Managed Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param parameters The SQL Managed Instance. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance. + * @return a SqlManagedInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance) { - return createAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance).block(); + public Response updateWithResponse(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, contentType, accept, parameters, + context); } /** - * Creates or replaces a SQL Managed Instance resource. + * Updates a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of SQL Managed Instances. - * @param sqlManagedInstance The SQL Managed Instance to be created or updated. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param parameters The SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlManagedInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlManagedInstanceInner create(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceInner sqlManagedInstance, Context context) { - return createAsync(resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, context).block(); + public SqlManagedInstanceInner update(String resourceGroupName, String sqlManagedInstanceName, + SqlManagedInstanceUpdate parameters) { + return updateWithResponse(resourceGroupName, sqlManagedInstanceName, parameters, Context.NONE).getValue(); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -772,109 +564,69 @@ public SqlManagedInstanceInner create(String resourceGroupName, String sqlManage @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync(String resourceGroupName, String sqlManagedInstanceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, - String sqlManagedInstanceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlManagedInstanceName, this.client.getApiVersion(), accept, context); + private Response deleteWithResponse(String resourceGroupName, String sqlManagedInstanceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, Context.NONE); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String sqlManagedInstanceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlManagedInstanceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlManagedInstanceName, context); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlManagedInstanceName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName, context); + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String sqlManagedInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlManagedInstanceName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -882,14 +634,15 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName) { - return this.beginDeleteAsync(resourceGroupName, sqlManagedInstanceName).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, sqlManagedInstanceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -899,14 +652,15 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlManagedInstanceName, Context context) { - return this.beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, context).getSyncPoller(); + Response response = deleteWithResponse(resourceGroupName, sqlManagedInstanceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -921,187 +675,241 @@ private Mono deleteAsync(String resourceGroupName, String sqlManagedInstan /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String sqlManagedInstanceName, Context context) { - return beginDeleteAsync(resourceGroupName, sqlManagedInstanceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); + public void delete(String resourceGroupName, String sqlManagedInstanceName) { + beginDelete(resourceGroupName, sqlManagedInstanceName).getFinalResult(); } /** * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String sqlManagedInstanceName) { - deleteAsync(resourceGroupName, sqlManagedInstanceName).block(); + public void delete(String resourceGroupName, String sqlManagedInstanceName, Context context) { + beginDelete(resourceGroupName, sqlManagedInstanceName, context).getFinalResult(); } /** - * Deletes a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. - * @param context The context to associate with this operation. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String sqlManagedInstanceName, Context context) { - deleteAsync(resourceGroupName, sqlManagedInstanceName, context).block(); + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. + * @return a list of SqlManagedInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlManagedInstance resources in the resource group + * + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, sqlManagedInstanceName, this.client.getApiVersion(), parameters, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response} on successful completion of {@link Mono}. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String sqlManagedInstanceName, SqlManagedInstanceUpdate parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlManagedInstanceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter sqlManagedInstanceName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlManagedInstanceName, this.client.getApiVersion(), parameters, accept, context); + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance on successful completion of {@link Mono}. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceUpdate parameters) { - return updateWithResponseAsync(resourceGroupName, sqlManagedInstanceName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response}. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List sqlManagedInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceUpdate parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, sqlManagedInstanceName, parameters, context).block(); + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a SQL Managed Instance resource. + * List sqlManagedInstance resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of sqlManagedInstance. - * @param parameters The SQL Managed Instance. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlManagedInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlManagedInstance resources in the subscription. + * + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlManagedInstanceInner update(String resourceGroupName, String sqlManagedInstanceName, - SqlManagedInstanceUpdate parameters) { - return updateWithResponse(resourceGroupName, sqlManagedInstanceName, parameters, Context.NONE).getValue(); + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlManagedInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List sqlManagedInstance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** + * List sqlManagedInstance resources in the resource group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1111,22 +919,39 @@ public SqlManagedInstanceInner update(String resourceGroupName, String sqlManage * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** + * List sqlManagedInstance resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlManagedInstance resources in the resource group + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1134,25 +959,20 @@ private Mono> listNextSinglePageAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** + * List sqlManagedInstance resources in the subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1162,24 +982,37 @@ private Mono> listNextSinglePageAsync(Str * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private Mono> listNextSinglePageAsync(String nextLink) { final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** + * List sqlManagedInstance resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlManagedInstance resources in the subscription + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -1187,22 +1020,14 @@ private Mono> listByResourceGroupNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of SqlManagedInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, - Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private PagedResponse listNextSinglePage(String nextLink, Context context) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java index 374eafb81e53..b7ab0d863afc 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -27,37 +27,12 @@ public SqlManagedInstancesImpl(SqlManagedInstancesClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); - } - public Response getByResourceGroupWithResponse(String resourceGroupName, String sqlManagedInstanceName, Context context) { Response inner = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlManagedInstanceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SqlManagedInstanceImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlManagedInstanceImpl(inner.getValue(), this.manager())); } public SqlManagedInstance getByResourceGroup(String resourceGroupName, String sqlManagedInstanceName) { @@ -78,6 +53,27 @@ public void delete(String resourceGroupName, String sqlManagedInstanceName, Cont this.serviceClient().delete(resourceGroupName, sqlManagedInstanceName, context); } + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlManagedInstanceImpl(inner1, this.manager())); + } + public SqlManagedInstance getById(String id) { String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java new file mode 100644 index 000000000000..409fbeca2938 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerAvailabilityGroupResourceImpl implements SqlServerAvailabilityGroupResource, + SqlServerAvailabilityGroupResource.Definition, SqlServerAvailabilityGroupResource.Update { + private SqlServerAvailabilityGroupResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerAvailabilityGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerInstanceName; + + private String availabilityGroupName; + + private SqlServerAvailabilityGroupUpdate updateSqlServerAvailabilityGroupUpdate; + + public SqlServerAvailabilityGroupResourceImpl withExistingSqlServerInstance(String resourceGroupName, + String sqlServerInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlServerInstanceName = sqlServerInstanceName; + return this; + } + + public SqlServerAvailabilityGroupResource create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .createWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .createWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, this.innerModel(), + context) + .getValue(); + return this; + } + + SqlServerAvailabilityGroupResourceImpl(String name, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerAvailabilityGroupResourceInner(); + this.serviceManager = serviceManager; + this.availabilityGroupName = name; + } + + public SqlServerAvailabilityGroupResourceImpl update() { + this.updateSqlServerAvailabilityGroupUpdate = new SqlServerAvailabilityGroupUpdate(); + return this; + } + + public SqlServerAvailabilityGroupResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .update(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + updateSqlServerAvailabilityGroupUpdate, Context.NONE); + return this; + } + + public SqlServerAvailabilityGroupResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .update(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + updateSqlServerAvailabilityGroupUpdate, context); + return this; + } + + SqlServerAvailabilityGroupResourceImpl(SqlServerAvailabilityGroupResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerInstances"); + this.availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "availabilityGroups"); + } + + public SqlServerAvailabilityGroupResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerAvailabilityGroupResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerAvailabilityGroups() + .getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context) + .getValue(); + return this; + } + + public Response detailViewWithResponse(Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .detailViewWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public SqlServerAvailabilityGroupResource detailView() { + return serviceManager.sqlServerAvailabilityGroups() + .detailView(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public Response failoverWithResponse(Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .failoverWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public SqlServerAvailabilityGroupResource failover() { + return serviceManager.sqlServerAvailabilityGroups() + .failover(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public Response forceFailoverAllowDataLossWithResponse(Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + context); + } + + public SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss() { + return serviceManager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLoss(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public Response addDatabasesWithResponse(Databases databases, Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + } + + public SqlServerAvailabilityGroupResource addDatabases(Databases databases) { + return serviceManager.sqlServerAvailabilityGroups() + .addDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + } + + public SqlServerAvailabilityGroupResource failoverMiLink(FailoverMiLinkResourceId managedInstanceResourceId) { + return serviceManager.sqlServerAvailabilityGroups() + .failoverMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, managedInstanceResourceId); + } + + public SqlServerAvailabilityGroupResource failoverMiLink(FailoverMiLinkResourceId managedInstanceResourceId, + Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .failoverMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, managedInstanceResourceId, + context); + } + + public void deleteMiLink() { + serviceManager.sqlServerAvailabilityGroups() + .deleteMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public void deleteMiLink(Context context) { + serviceManager.sqlServerAvailabilityGroups() + .deleteMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public Response removeDatabasesWithResponse(Databases databases, + Context context) { + return serviceManager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + } + + public SqlServerAvailabilityGroupResource removeDatabases(Databases databases) { + return serviceManager.sqlServerAvailabilityGroups() + .removeDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + } + + public SqlServerAvailabilityGroupResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerAvailabilityGroupResourceImpl + withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlServerAvailabilityGroupUpdate.withProperties(properties); + return this; + } + } + + public SqlServerAvailabilityGroupResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlServerAvailabilityGroupUpdate.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java new file mode 100644 index 000000000000..ab12721d75de --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java @@ -0,0 +1,2506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerAvailabilityGroupListResult; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlServerAvailabilityGroupsClient. + */ +public final class SqlServerAvailabilityGroupsClientImpl implements SqlServerAvailabilityGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerAvailabilityGroupsService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerAvailabilityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerAvailabilityGroupsClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(SqlServerAvailabilityGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerAvailabilityGroups to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientSqlServerAvailabilityGroups") + public interface SqlServerAvailabilityGroupsService { + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createAvailabilityGroup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createAvailabilityGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createAvailabilityGroup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createAvailabilityGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createDistributedAvailabilityGroup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createDistributedAvailabilityGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createDistributedAvailabilityGroup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createDistributedAvailabilityGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createManagedInstanceLink") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createManagedInstanceLink(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/createManagedInstanceLink") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createManagedInstanceLinkSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/getDetailView") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> detailView(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/getDetailView") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response detailViewSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/failover") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> failover(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/failover") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response failoverSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> forceFailoverAllowDataLoss( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response forceFailoverAllowDataLossSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/addDatabases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> addDatabases(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") Databases databases, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/addDatabases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addDatabasesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") Databases databases, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/failoverMiLink") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failoverMiLink(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FailoverMiLinkResourceId managedInstanceResourceId, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/failoverMiLink") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response failoverMiLinkSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FailoverMiLinkResourceId managedInstanceResourceId, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/deleteMiLink") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteMiLink(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/deleteMiLink") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteMiLinkSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/removeDatabases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> removeDatabases(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") Databases databases, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/availabilityGroups/{availabilityGroupName}/removeDatabases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response removeDatabasesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("availabilityGroupName") String availabilityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") Databases databases, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAvailabilityGroupWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createAvailabilityGroup(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + contentType, accept, createAgConfiguration, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createAvailabilityGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createAvailabilityGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + createAgConfiguration, Context.NONE); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createAvailabilityGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createAvailabilityGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + createAgConfiguration, context); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroupAsync(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + Mono>> mono + = createAvailabilityGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + Response response + = createAvailabilityGroupWithResponse(resourceGroupName, sqlServerInstanceName, createAgConfiguration); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, + Context.NONE); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context) { + Response response = createAvailabilityGroupWithResponse(resourceGroupName, sqlServerInstanceName, + createAgConfiguration, context); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAvailabilityGroupAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + return beginCreateAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, createAgConfiguration).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + return beginCreateAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createAgConfiguration) + .getFinalResult(); + } + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context) { + return beginCreateAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createAgConfiguration, context) + .getFinalResult(); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createDistributedAvailabilityGroupWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createDistributedAvailabilityGroup(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + contentType, accept, createDagConfiguration, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createDistributedAvailabilityGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createDistributedAvailabilityGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + createDagConfiguration, Context.NONE); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createDistributedAvailabilityGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createDistributedAvailabilityGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + createDagConfiguration, context); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroupAsync(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + Mono>> mono = createDistributedAvailabilityGroupWithResponseAsync(resourceGroupName, + sqlServerInstanceName, createDagConfiguration); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + Response response = createDistributedAvailabilityGroupWithResponse(resourceGroupName, + sqlServerInstanceName, createDagConfiguration); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, + Context.NONE); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateDistributedAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, Context context) { + Response response = createDistributedAvailabilityGroupWithResponse(resourceGroupName, + sqlServerInstanceName, createDagConfiguration, context); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createDistributedAvailabilityGroupAsync( + String resourceGroupName, String sqlServerInstanceName, + DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + return beginCreateDistributedAvailabilityGroupAsync(resourceGroupName, sqlServerInstanceName, + createDagConfiguration).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + return beginCreateDistributedAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createDagConfiguration) + .getFinalResult(); + } + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context) { + return beginCreateDistributedAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createDagConfiguration, + context).getFinalResult(); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createManagedInstanceLinkWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createManagedInstanceLink(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + contentType, accept, createManagedInstanceLinkConfiguration, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createManagedInstanceLinkWithResponse(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createManagedInstanceLinkSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + createManagedInstanceLinkConfiguration, Context.NONE); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createManagedInstanceLinkWithResponse(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createManagedInstanceLinkSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + createManagedInstanceLinkConfiguration, context); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginCreateManagedInstanceLinkAsync(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + Mono>> mono = createManagedInstanceLinkWithResponseAsync(resourceGroupName, + sqlServerInstanceName, createManagedInstanceLinkConfiguration); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateManagedInstanceLink(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + Response response = createManagedInstanceLinkWithResponse(resourceGroupName, sqlServerInstanceName, + createManagedInstanceLinkConfiguration); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, + Context.NONE); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginCreateManagedInstanceLink(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context) { + Response response = createManagedInstanceLinkWithResponse(resourceGroupName, sqlServerInstanceName, + createManagedInstanceLinkConfiguration, context); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createManagedInstanceLinkAsync(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + return beginCreateManagedInstanceLinkAsync(resourceGroupName, sqlServerInstanceName, + createManagedInstanceLinkConfiguration).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createManagedInstanceLink(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + return beginCreateManagedInstanceLink(resourceGroupName, sqlServerInstanceName, + createManagedInstanceLinkConfiguration).getFinalResult(); + } + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner createManagedInstanceLink(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context) { + return beginCreateManagedInstanceLink(resourceGroupName, sqlServerInstanceName, + createManagedInstanceLinkConfiguration, context).getFinalResult(); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, availabilityGroupName, accept, context); + } + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, sqlServerAvailabilityGroupResource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + return createWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupResource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, sqlServerAvailabilityGroupResource, context); + } + + /** + * Creates or replaces an Arc Sql Server Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupResource The request body for availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner create(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupResourceInner sqlServerAvailabilityGroupResource) { + return createWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupResource, Context.NONE).getValue(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, sqlServerAvailabilityGroupUpdate, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, sqlServerAvailabilityGroupUpdate, Context.NONE); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, sqlServerAvailabilityGroupUpdate, context); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginUpdateAsync(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, sqlServerAvailabilityGroupUpdate); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + Response response = updateWithResponse(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, sqlServerAvailabilityGroupUpdate); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, + Context.NONE); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginUpdate(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, Context context) { + Response response = updateWithResponse(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, sqlServerAvailabilityGroupUpdate, context); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate) { + return beginUpdate(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate).getFinalResult(); + } + + /** + * Updates an existing Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param sqlServerAvailabilityGroupUpdate The requested server availability group resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, SqlServerAvailabilityGroupUpdate sqlServerAvailabilityGroupUpdate, + Context context) { + return beginUpdate(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + sqlServerAvailabilityGroupUpdate, context).getFinalResult(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + Context.NONE); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + Response response + = deleteWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + beginDelete(resourceGroupName, sqlServerInstanceName, availabilityGroupName).getFinalResult(); + } + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + beginDelete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context).getFinalResult(); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String sqlServerInstanceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, sqlServerInstanceName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> detailViewWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.detailView(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono detailViewAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return detailViewWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + final String accept = "application/json"; + return service.detailViewSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, accept, + context); + } + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return detailViewWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> failoverWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.failover(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return failoverWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + final String accept = "application/json"; + return service.failoverSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, accept, + context); + } + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return failoverWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.forceFailoverAllowDataLoss(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + availabilityGroupName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response forceFailoverAllowDataLossWithResponse( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Context context) { + final String accept = "application/json"; + return service.forceFailoverAllowDataLossSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, accept, + context); + } + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return forceFailoverAllowDataLossWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + Context.NONE).getValue(); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addDatabasesWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.addDatabases(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, databases, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addDatabasesAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + return addDatabasesWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.addDatabasesSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, databases, context); + } + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases) { + return addDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + Context.NONE).getValue(); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverMiLinkWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.failoverMiLink(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, managedInstanceResourceId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response failoverMiLinkWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.failoverMiLinkSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, managedInstanceResourceId, Context.NONE); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response failoverMiLinkWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.failoverMiLinkSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, managedInstanceResourceId, context); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerAvailabilityGroupResourceInner> + beginFailoverMiLinkAsync(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId) { + Mono>> mono = failoverMiLinkWithResponseAsync(resourceGroupName, + sqlServerInstanceName, availabilityGroupName, managedInstanceResourceId); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerAvailabilityGroupResourceInner.class, + SqlServerAvailabilityGroupResourceInner.class, this.client.getContext()); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginFailoverMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId) { + Response response = failoverMiLinkWithResponse(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, managedInstanceResourceId); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, + Context.NONE); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerAvailabilityGroupResourceInner> + beginFailoverMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId, Context context) { + Response response = failoverMiLinkWithResponse(resourceGroupName, sqlServerInstanceName, + availabilityGroupName, managedInstanceResourceId, context); + return this.client + .getLroResult(response, + SqlServerAvailabilityGroupResourceInner.class, SqlServerAvailabilityGroupResourceInner.class, context); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverMiLinkAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId) { + return beginFailoverMiLinkAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + managedInstanceResourceId).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner failoverMiLink(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, + FailoverMiLinkResourceId managedInstanceResourceId) { + return beginFailoverMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + managedInstanceResourceId).getFinalResult(); + } + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner failoverMiLink(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId, + Context context) { + return beginFailoverMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + managedInstanceResourceId, context).getFinalResult(); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteMiLinkWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + return FluxUtil + .withContext(context -> service.deleteMiLink(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteMiLinkWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return service.deleteMiLinkSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + Context.NONE); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteMiLinkWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context) { + return service.deleteMiLinkSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteMiLinkAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + Mono>> mono + = deleteMiLinkWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + Response response + = deleteMiLinkWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context) { + Response response + = deleteMiLinkWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteMiLinkAsync(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + return beginDeleteMiLinkAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + beginDeleteMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName).getFinalResult(); + } + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + beginDeleteMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context).getFinalResult(); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> removeDatabasesWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.removeDatabases(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, databases, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono removeDatabasesAsync(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + return removeDatabasesWithResponseAsync(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + databases).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.removeDatabasesSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, availabilityGroupName, + contentType, accept, databases, context); + } + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerAvailabilityGroupResourceInner removeDatabases(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases) { + return removeDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + Context.NONE).getValue(); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the availability group associated with the given Arc Sql Server. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java new file mode 100644 index 000000000000..87c14ca0f29a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroups; + +public final class SqlServerAvailabilityGroupsImpl implements SqlServerAvailabilityGroups { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerAvailabilityGroupsImpl.class); + + private final SqlServerAvailabilityGroupsClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerAvailabilityGroupsImpl(SqlServerAvailabilityGroupsClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createAgConfiguration); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, + Context context) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createAgConfiguration, context); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createDistributedAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createDagConfiguration); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createDistributedAvailabilityGroup(resourceGroupName, sqlServerInstanceName, createDagConfiguration, + context); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createManagedInstanceLink(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createManagedInstanceLink(resourceGroupName, sqlServerInstanceName, + createManagedInstanceLinkConfiguration); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource createManagedInstanceLink(String resourceGroupName, + String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .createManagedInstanceLink(resourceGroupName, sqlServerInstanceName, createManagedInstanceLinkConfiguration, + context); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerAvailabilityGroupResource get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner + = this.serviceClient().get(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, + String sqlServerInstanceName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .detailViewWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerAvailabilityGroupResource detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner + = this.serviceClient().detailView(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .failoverWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerAvailabilityGroupResource failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner + = this.serviceClient().failover(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response forceFailoverAllowDataLossWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context) { + Response inner = this.serviceClient() + .forceFailoverAllowDataLossWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .forceFailoverAllowDataLoss(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + Response inner = this.serviceClient() + .addDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerAvailabilityGroupResource addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .addDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource failoverMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .failoverMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, managedInstanceResourceId); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource failoverMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId, Context context) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .failoverMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, managedInstanceResourceId, + context); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName) { + this.serviceClient().deleteMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName); + } + + public void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context) { + this.serviceClient().deleteMiLink(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context) { + Response inner = this.serviceClient() + .removeDatabasesWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerAvailabilityGroupResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerAvailabilityGroupResource removeDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases) { + SqlServerAvailabilityGroupResourceInner inner = this.serviceClient() + .removeDatabases(resourceGroupName, sqlServerInstanceName, availabilityGroupName, databases); + if (inner != null) { + return new SqlServerAvailabilityGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerAvailabilityGroupResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String availabilityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "availabilityGroups"); + if (availabilityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'availabilityGroups'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, availabilityGroupName, context); + } + + private SqlServerAvailabilityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerAvailabilityGroupResourceImpl define(String name) { + return new SqlServerAvailabilityGroupResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java new file mode 100644 index 000000000000..ea7e806f626a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerDatabaseResourceImpl + implements SqlServerDatabaseResource, SqlServerDatabaseResource.Definition, SqlServerDatabaseResource.Update { + private SqlServerDatabaseResourceInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SqlServerDatabaseResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerDatabaseResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerInstanceName; + + private String databaseName; + + private SqlServerDatabaseUpdate updateSqlServerDatabaseUpdate; + + public SqlServerDatabaseResourceImpl withExistingSqlServerInstance(String resourceGroupName, + String sqlServerInstanceName) { + this.resourceGroupName = resourceGroupName; + this.sqlServerInstanceName = sqlServerInstanceName; + return this; + } + + public SqlServerDatabaseResource create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .createWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerDatabaseResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .createWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerDatabaseResourceImpl(String name, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerDatabaseResourceInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public SqlServerDatabaseResourceImpl update() { + this.updateSqlServerDatabaseUpdate = new SqlServerDatabaseUpdate(); + return this; + } + + public SqlServerDatabaseResource apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .update(resourceGroupName, sqlServerInstanceName, databaseName, updateSqlServerDatabaseUpdate, + Context.NONE); + return this; + } + + public SqlServerDatabaseResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .update(resourceGroupName, sqlServerInstanceName, databaseName, updateSqlServerDatabaseUpdate, context); + return this; + } + + SqlServerDatabaseResourceImpl(SqlServerDatabaseResourceInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerInstances"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public SqlServerDatabaseResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerDatabaseResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerDatabases() + .getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context) + .getValue(); + return this; + } + + public SqlServerDatabaseResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerDatabaseResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerDatabaseResourceImpl withProperties(SqlServerDatabaseResourceProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateSqlServerDatabaseUpdate.withProperties(properties); + return this; + } + } + + public SqlServerDatabaseResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSqlServerDatabaseUpdate.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java new file mode 100644 index 000000000000..9cf715f4c03f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java @@ -0,0 +1,894 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerDatabaseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlServerDatabasesClient. + */ +public final class SqlServerDatabasesClientImpl implements SqlServerDatabasesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerDatabasesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerDatabasesClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(SqlServerDatabasesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientSqlServerDatabases") + public interface SqlServerDatabasesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerDatabaseResourceInner sqlServerDatabaseResource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerDatabaseResourceInner sqlServerDatabaseResource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @PathParam("databaseName") String databaseName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + return getWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String sqlServerInstanceName, String databaseName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, databaseName, accept, context); + } + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner get(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + return getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE).getValue(); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, contentType, + accept, sqlServerDatabaseResource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource) { + return createWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, + sqlServerDatabaseResource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, contentType, + accept, sqlServerDatabaseResource, context); + } + + /** + * Creates or replaces an Arc Sql Server Database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseResource The request body for database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner create(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseResourceInner sqlServerDatabaseResource) { + return createWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseResource, + Context.NONE).getValue(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, contentType, + accept, sqlServerDatabaseUpdate, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, contentType, + accept, sqlServerDatabaseUpdate, Context.NONE); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, contentType, + accept, sqlServerDatabaseUpdate, context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerDatabaseResourceInner> beginUpdateAsync( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerDatabaseResourceInner.class, SqlServerDatabaseResourceInner.class, + this.client.getContext()); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + Response response + = updateWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate); + return this.client.getLroResult(response, + SqlServerDatabaseResourceInner.class, SqlServerDatabaseResourceInner.class, Context.NONE); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerDatabaseResourceInner> beginUpdate( + String resourceGroupName, String sqlServerInstanceName, String databaseName, + SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + Response response = updateWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, + sqlServerDatabaseUpdate, context); + return this.client.getLroResult(response, + SqlServerDatabaseResourceInner.class, SqlServerDatabaseResourceInner.class, context); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate) { + return beginUpdate(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate) + .getFinalResult(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param sqlServerDatabaseUpdate The requested database resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerDatabaseResourceInner update(String resourceGroupName, String sqlServerInstanceName, + String databaseName, SqlServerDatabaseUpdate sqlServerDatabaseUpdate, Context context) { + return beginUpdate(resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, context) + .getFinalResult(); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, String databaseName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, databaseName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName) { + Response response = deleteWithResponse(resourceGroupName, sqlServerInstanceName, databaseName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, databaseName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + beginDelete(resourceGroupName, sqlServerInstanceName, databaseName).getFinalResult(); + } + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context) { + beginDelete(resourceGroupName, sqlServerInstanceName, databaseName, context).getFinalResult(); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, + String sqlServerInstanceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, sqlServerInstanceName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, sqlServerInstanceName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the databases associated with the given Arc Sql Server. + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java new file mode 100644 index 000000000000..a320cd4a4ec6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabases; + +public final class SqlServerDatabasesImpl implements SqlServerDatabases { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerDatabasesImpl.class); + + private final SqlServerDatabasesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerDatabasesImpl(SqlServerDatabasesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerDatabaseResourceImpl(inner.getValue(), this.manager())); + } + + public SqlServerDatabaseResource get(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + SqlServerDatabaseResourceInner inner + = this.serviceClient().get(resourceGroupName, sqlServerInstanceName, databaseName); + if (inner != null) { + return new SqlServerDatabaseResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, databaseName); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerDatabaseResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, sqlServerInstanceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerDatabaseResourceImpl(inner1, this.manager())); + } + + public SqlServerDatabaseResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, databaseName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerInstanceName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerInstances"); + if (sqlServerInstanceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerInstances'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, sqlServerInstanceName, databaseName, context); + } + + private SqlServerDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerDatabaseResourceImpl define(String name) { + return new SqlServerDatabaseResourceImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java new file mode 100644 index 000000000000..85e8ae013e98 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerEsuLicenseImpl + implements SqlServerEsuLicense, SqlServerEsuLicense.Definition, SqlServerEsuLicense.Update { + private SqlServerEsuLicenseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SqlServerEsuLicenseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerEsuLicenseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerEsuLicenseName; + + private SqlServerEsuLicenseUpdate updateParameters; + + public SqlServerEsuLicenseImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SqlServerEsuLicense create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .createWithResponse(resourceGroupName, sqlServerEsuLicenseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerEsuLicense create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .createWithResponse(resourceGroupName, sqlServerEsuLicenseName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerEsuLicenseImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerEsuLicenseInner(); + this.serviceManager = serviceManager; + this.sqlServerEsuLicenseName = name; + } + + public SqlServerEsuLicenseImpl update() { + this.updateParameters = new SqlServerEsuLicenseUpdate(); + return this; + } + + public SqlServerEsuLicense apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .updateWithResponse(resourceGroupName, sqlServerEsuLicenseName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SqlServerEsuLicense apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .updateWithResponse(resourceGroupName, sqlServerEsuLicenseName, updateParameters, context) + .getValue(); + return this; + } + + SqlServerEsuLicenseImpl(SqlServerEsuLicenseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerEsuLicenseName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerEsuLicenses"); + } + + public SqlServerEsuLicense refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerEsuLicense refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerEsuLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context) + .getValue(); + return this; + } + + public SqlServerEsuLicenseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerEsuLicenseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerEsuLicenseImpl withProperties(SqlServerEsuLicenseProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SqlServerEsuLicenseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SqlServerEsuLicenseImpl withProperties(SqlServerEsuLicenseUpdateProperties properties) { + this.updateParameters.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java new file mode 100644 index 000000000000..5424cf016f9a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java @@ -0,0 +1,849 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerEsuLicenseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlServerEsuLicensesClient. + */ +public final class SqlServerEsuLicensesClientImpl implements SqlServerEsuLicensesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerEsuLicensesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerEsuLicensesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerEsuLicensesClientImpl(AzureArcDataManagementClientImpl client) { + this.service = RestProxy.create(SqlServerEsuLicensesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerEsuLicenses to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientSqlServerEsuLicenses") + public interface SqlServerEsuLicensesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerEsuLicenseInner sqlServerEsuLicense, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerEsuLicenseInner sqlServerEsuLicense, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerEsuLicenseUpdate parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerEsuLicenseUpdate parameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses/{sqlServerEsuLicenseName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerEsuLicenseName") String sqlServerEsuLicenseName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerEsuLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String sqlServerEsuLicenseName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, accept, context); + } + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerEsuLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName) { + return getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseInner sqlServerEsuLicense) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, contentType, accept, + sqlServerEsuLicense, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense) { + return createWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, sqlServerEsuLicense) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseInner sqlServerEsuLicense, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, contentType, accept, + sqlServerEsuLicense, context); + } + + /** + * Creates or replaces a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param sqlServerEsuLicense The SQL Server ESU license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerEsuLicenseInner create(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseInner sqlServerEsuLicense) { + return createWithResponse(resourceGroupName, sqlServerEsuLicenseName, sqlServerEsuLicense, Context.NONE) + .getValue(); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseUpdate parameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, contentType, accept, + parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, SqlServerEsuLicenseUpdate parameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, contentType, accept, + parameters, context); + } + + /** + * Updates a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param parameters The SQL Server ESU license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerEsuLicenseInner update(String resourceGroupName, String sqlServerEsuLicenseName, + SqlServerEsuLicenseUpdate parameters) { + return updateWithResponse(resourceGroupName, sqlServerEsuLicenseName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String sqlServerEsuLicenseName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerEsuLicenseName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerEsuLicenseName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerEsuLicenseName, context); + } + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerEsuLicenseName) { + deleteWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerEsuLicense resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerEsuLicense resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java new file mode 100644 index 000000000000..a4ca7bfaa095 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenses; + +public final class SqlServerEsuLicensesImpl implements SqlServerEsuLicenses { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerEsuLicensesImpl.class); + + private final SqlServerEsuLicensesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerEsuLicensesImpl(SqlServerEsuLicensesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerEsuLicenseImpl(inner.getValue(), this.manager())); + } + + public SqlServerEsuLicense getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName) { + SqlServerEsuLicenseInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerEsuLicenseName); + if (inner != null) { + return new SqlServerEsuLicenseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName) { + this.serviceClient().delete(resourceGroupName, sqlServerEsuLicenseName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerEsuLicenseImpl(inner1, this.manager())); + } + + public SqlServerEsuLicense getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerEsuLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerEsuLicenses"); + if (sqlServerEsuLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerEsuLicenses'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerEsuLicenseName, context); + } + + private SqlServerEsuLicensesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerEsuLicenseImpl define(String name) { + return new SqlServerEsuLicenseImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java index e9ac76a170f7..5cab4f3034f7 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java @@ -1,17 +1,39 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceMigrationReadinessReportResponse; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunBestPracticesAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationReadinessAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdateProperties; import java.util.Collections; +import java.util.List; import java.util.Map; public final class SqlServerInstanceImpl @@ -112,16 +134,14 @@ public SqlServerInstanceImpl update() { public SqlServerInstance apply() { this.innerObject = serviceManager.serviceClient() .getSqlServerInstances() - .updateWithResponse(resourceGroupName, sqlServerInstanceName, updateParameters, Context.NONE) - .getValue(); + .update(resourceGroupName, sqlServerInstanceName, updateParameters, Context.NONE); return this; } public SqlServerInstance apply(Context context) { this.innerObject = serviceManager.serviceClient() .getSqlServerInstances() - .updateWithResponse(resourceGroupName, sqlServerInstanceName, updateParameters, context) - .getValue(); + .update(resourceGroupName, sqlServerInstanceName, updateParameters, context); return this; } @@ -149,6 +169,169 @@ public SqlServerInstance refresh(Context context) { return this; } + public PagedIterable> + getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return serviceManager.sqlServerInstances() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest); + } + + public PagedIterable> getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + Context context) { + return serviceManager.sqlServerInstances() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest, context); + } + + public PagedIterable> + getBestPracticesAssessment(SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest) { + return serviceManager.sqlServerInstances() + .getBestPracticesAssessment(resourceGroupName, sqlServerInstanceName, sqlServerInstanceBpaRequest); + } + + public PagedIterable> + getBestPracticesAssessment(SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context) { + return serviceManager.sqlServerInstances() + .getBestPracticesAssessment(resourceGroupName, sqlServerInstanceName, sqlServerInstanceBpaRequest, context); + } + + public Response + runMigrationAssessmentWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .runMigrationAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment() { + return serviceManager.sqlServerInstances().runMigrationAssessment(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob() { + return serviceManager.sqlServerInstances().runTargetRecommendationJob(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob( + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context) { + return serviceManager.sqlServerInstances() + .runTargetRecommendationJob(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest, context); + } + + public SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports() { + return serviceManager.sqlServerInstances() + .getTargetRecommendationReports(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports( + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context) { + return serviceManager.sqlServerInstances() + .getTargetRecommendationReports(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTargetRecommendationReportsRequest, context); + } + + public SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport() { + return serviceManager.sqlServerInstances() + .getMigrationReadinessReport(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(Context context) { + return serviceManager.sqlServerInstances() + .getMigrationReadinessReport(resourceGroupName, sqlServerInstanceName, context); + } + + public Response + runBestPracticesAssessmentWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .runBestPracticesAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticesAssessment() { + return serviceManager.sqlServerInstances().runBestPracticesAssessment(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment() { + return serviceManager.sqlServerInstances().runBestPracticeAssessment(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(Context context) { + return serviceManager.sqlServerInstances() + .runBestPracticeAssessment(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstanceRunMigrationReadinessAssessmentResponse runMigrationReadinessAssessment() { + return serviceManager.sqlServerInstances() + .runMigrationReadinessAssessment(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceRunMigrationReadinessAssessmentResponse runMigrationReadinessAssessment(Context context) { + return serviceManager.sqlServerInstances() + .runMigrationReadinessAssessment(resourceGroupName, sqlServerInstanceName, context); + } + + public Response getJobsStatusWithResponse( + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, Context context) { + return serviceManager.sqlServerInstances() + .getJobsStatusWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsStatusRequest, + context); + } + + public SqlServerInstanceJobsStatusResponse getJobsStatus() { + return serviceManager.sqlServerInstances().getJobsStatus(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceJobsResponse getJobs() { + return serviceManager.sqlServerInstances().getJobs(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceJobsResponse getJobs(SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, + Context context) { + return serviceManager.sqlServerInstances() + .getJobs(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest, context); + } + + public Response preUpgradeWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .preUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstance preUpgrade() { + return serviceManager.sqlServerInstances().preUpgrade(resourceGroupName, sqlServerInstanceName); + } + + public Response postUpgradeWithResponse(Context context) { + return serviceManager.sqlServerInstances() + .postUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + } + + public SqlServerInstance postUpgrade() { + return serviceManager.sqlServerInstances().postUpgrade(resourceGroupName, sqlServerInstanceName); + } + + public SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment( + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + return serviceManager.sqlServerInstances() + .runManagedInstanceLinkAssessment(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest); + } + + public SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment( + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context) { + return serviceManager.sqlServerInstances() + .runManagedInstanceLinkAssessment(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest, context); + } + + public PagedIterable getAllAvailabilityGroups() { + return serviceManager.sqlServerInstances().getAllAvailabilityGroups(resourceGroupName, sqlServerInstanceName); + } + + public PagedIterable + getAllAvailabilityGroups(AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, Context context) { + return serviceManager.sqlServerInstances() + .getAllAvailabilityGroups(resourceGroupName, sqlServerInstanceName, availabilityGroupRetrievalFilters, + context); + } + public SqlServerInstanceImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; @@ -174,7 +357,12 @@ public SqlServerInstanceImpl withProperties(SqlServerInstanceProperties properti return this; } + public SqlServerInstanceImpl withProperties(SqlServerInstanceUpdateProperties properties) { + this.updateParameters.withProperties(properties); + return this; + } + private boolean isInCreateMode() { - return this.innerModel().id() == null; + return this.innerModel() == null || this.innerModel().id() == null; } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsResponseImpl.java new file mode 100644 index 000000000000..96b0e2037697 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsResponseImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJob; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceJobsResponseImpl implements SqlServerInstanceJobsResponse { + private SqlServerInstanceJobsResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceJobsResponseImpl(SqlServerInstanceJobsResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List jobs() { + List inner = this.innerModel().jobs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceJobsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java new file mode 100644 index 000000000000..399686919b9c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobStatus; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceJobsStatusResponseImpl implements SqlServerInstanceJobsStatusResponse { + private SqlServerInstanceJobsStatusResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceJobsStatusResponseImpl(SqlServerInstanceJobsStatusResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List jobsStatus() { + List inner = this.innerModel().jobsStatus(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceJobsStatusResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl.java new file mode 100644 index 000000000000..21fa6c4c9ccf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessment; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl + implements SqlServerInstanceManagedInstanceLinkAssessmentResponse { + private SqlServerInstanceManagedInstanceLinkAssessmentResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl( + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List assessments() { + List inner = this.innerModel().assessments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceManagedInstanceLinkAssessmentResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceMigrationReadinessReportResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceMigrationReadinessReportResponseImpl.java new file mode 100644 index 000000000000..6cd5cef49103 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceMigrationReadinessReportResponseImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceMigrationReadinessReportResponse; +import java.time.OffsetDateTime; + +public final class SqlServerInstanceMigrationReadinessReportResponseImpl + implements SqlServerInstanceMigrationReadinessReportResponse { + private SqlServerInstanceMigrationReadinessReportResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceMigrationReadinessReportResponseImpl( + SqlServerInstanceMigrationReadinessReportResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String report() { + return this.innerModel().report(); + } + + public Boolean isCompressed() { + return this.innerModel().isCompressed(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public SqlServerInstanceMigrationReadinessReportResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunBestPracticesAssessmentResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunBestPracticesAssessmentResponseImpl.java new file mode 100644 index 000000000000..0f89aef80f31 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunBestPracticesAssessmentResponseImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunBestPracticesAssessmentResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceRunBestPracticesAssessmentResponseImpl + implements SqlServerInstanceRunBestPracticesAssessmentResponse { + private SqlServerInstanceRunBestPracticesAssessmentResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceRunBestPracticesAssessmentResponseImpl( + SqlServerInstanceRunBestPracticesAssessmentResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String instanceName() { + return this.innerModel().instanceName(); + } + + public JobStatus jobStatus() { + return this.innerModel().jobStatus(); + } + + public String jobException() { + return this.innerModel().jobException(); + } + + public BackgroundJob backgroundJob() { + return this.innerModel().backgroundJob(); + } + + public List sequencerActions() { + List inner = this.innerModel().sequencerActions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceRunBestPracticesAssessmentResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java new file mode 100644 index 000000000000..3a3b4eea5855 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceRunMigrationAssessmentResponseImpl + implements SqlServerInstanceRunMigrationAssessmentResponse { + private SqlServerInstanceRunMigrationAssessmentResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceRunMigrationAssessmentResponseImpl( + SqlServerInstanceRunMigrationAssessmentResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String instanceName() { + return this.innerModel().instanceName(); + } + + public JobStatus jobStatus() { + return this.innerModel().jobStatus(); + } + + public String jobException() { + return this.innerModel().jobException(); + } + + public BackgroundJob backgroundJob() { + return this.innerModel().backgroundJob(); + } + + public List sequencerActions() { + List inner = this.innerModel().sequencerActions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceRunMigrationAssessmentResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl.java new file mode 100644 index 000000000000..d7561befb635 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationReadinessAssessmentResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl + implements SqlServerInstanceRunMigrationReadinessAssessmentResponse { + private SqlServerInstanceRunMigrationReadinessAssessmentResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl( + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String instanceName() { + return this.innerModel().instanceName(); + } + + public JobStatus jobStatus() { + return this.innerModel().jobStatus(); + } + + public String jobException() { + return this.innerModel().jobException(); + } + + public BackgroundJob backgroundJob() { + return this.innerModel().backgroundJob(); + } + + public List sequencerActions() { + List inner = this.innerModel().sequencerActions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SqlServerInstanceRunMigrationReadinessAssessmentResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunTargetRecommendationJobResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunTargetRecommendationJobResponseImpl.java new file mode 100644 index 000000000000..b87b5d8372ef --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunTargetRecommendationJobResponseImpl.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobResponse; + +public final class SqlServerInstanceRunTargetRecommendationJobResponseImpl + implements SqlServerInstanceRunTargetRecommendationJobResponse { + private SqlServerInstanceRunTargetRecommendationJobResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceRunTargetRecommendationJobResponseImpl( + SqlServerInstanceRunTargetRecommendationJobResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public JobStatus jobStatus() { + return this.innerModel().jobStatus(); + } + + public SqlServerInstanceRunTargetRecommendationJobResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceTargetRecommendationReportsResponseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceTargetRecommendationReportsResponseImpl.java new file mode 100644 index 000000000000..36c8e1e804ab --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceTargetRecommendationReportsResponseImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReport; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsResponse; +import java.util.Collections; +import java.util.List; + +public final class SqlServerInstanceTargetRecommendationReportsResponseImpl + implements SqlServerInstanceTargetRecommendationReportsResponse { + private SqlServerInstanceTargetRecommendationReportsResponseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + SqlServerInstanceTargetRecommendationReportsResponseImpl( + SqlServerInstanceTargetRecommendationReportsResponseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public JobStatus jobStatus() { + return this.innerModel().jobStatus(); + } + + public List reports() { + List inner = this.innerModel().reports(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Integer totalReportCount() { + return this.innerModel().totalReportCount(); + } + + public Integer nextReportOffset() { + return this.innerModel().nextReportOffset(); + } + + public Integer nextSectionOffset() { + return this.innerModel().nextSectionOffset(); + } + + public SqlServerInstanceTargetRecommendationReportsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java index 87989ee60c02..6cb6cba3610d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -14,6 +14,7 @@ import com.azure.core.annotation.HostParam; import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; @@ -28,15 +29,38 @@ import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceListResult; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerAvailabilityGroupListResult; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceBpaResponse; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceListResult; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceTelemetryResponse; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; import java.nio.ByteBuffer; +import java.util.List; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -69,338 +93,3292 @@ public final class SqlServerInstancesClientImpl implements SqlServerInstancesCli * The interface defining all the services for AzureArcDataManagementClientSqlServerInstances to be used by the * proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AzureArcDataManageme") + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientSqlServerInstances") public interface SqlServerInstancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceInner sqlServerInstance, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceInner sqlServerInstance, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceUpdate parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceUpdate parameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getTelemetry") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getTelemetry(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getTelemetry") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getTelemetrySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getBestPracticesAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getBestPracticesAssessment(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getBestPracticesAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getBestPracticesAssessmentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runMigrationAssessment") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("$host") String endpoint, + Mono> runMigrationAssessment( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("sqlServerInstanceName") String sqlServerInstanceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") - @ExpectedResponses({ 200, 201 }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runMigrationAssessment") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> create(@HostParam("$host") String endpoint, + Response runMigrationAssessmentSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("sqlServerInstanceName") String sqlServerInstanceName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlServerInstanceInner sqlServerInstance, - @HeaderParam("Accept") String accept, Context context); + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") - @ExpectedResponses({ 200, 202, 204 }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runTargetRecommendationJob") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> runTargetRecommendationJob(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runTargetRecommendationJob") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response runTargetRecommendationJobSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getTargetRecommendationReports") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getTargetRecommendationReports(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getTargetRecommendationReports") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getTargetRecommendationReportsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getMigrationReadinessReport") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getMigrationReadinessReport(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getMigrationReadinessReport") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getMigrationReadinessReportSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runBestPracticesAssessment") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("$host") String endpoint, + Mono> runBestPracticesAssessment( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("sqlServerInstanceName") String sqlServerInstanceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runBestPracticesAssessment") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, + Response runBestPracticesAssessmentSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runBestPracticeAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> runBestPracticeAssessment(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runBestPracticeAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response runBestPracticeAssessmentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runMigrationReadinessAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> runMigrationReadinessAssessment(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runMigrationReadinessAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response runMigrationReadinessAssessmentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getJobsStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getJobsStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getJobsStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getJobsStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getJobs") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getJobs(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getJobs") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getJobsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/preUpgrade") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> preUpgrade(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/preUpgrade") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response preUpgradeSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/postUpgrade") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> postUpgrade(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/postUpgrade") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response postUpgradeSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runManagedInstanceLinkAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> runManagedInstanceLinkAssessment(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlServerInstanceName") String sqlServerInstanceName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SqlServerInstanceUpdate parameters, @HeaderParam("Accept") String accept, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, Context context); + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/runManagedInstanceLinkAssessment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response runManagedInstanceLinkAssessmentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getAllAvailabilityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAllAvailabilityGroups( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/getAllAvailabilityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getAllAvailabilityGroupsSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerInstanceName") String sqlServerInstanceName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTelemetryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getTelemetryNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBestPracticesAssessmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getBestPracticesAssessmentNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAllAvailabilityGroupsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getAllAvailabilityGroupsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String sqlServerInstanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); + } + + /** + * Retrieves a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner getByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { + return getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + sqlServerInstance, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + sqlServerInstance, Context.NONE); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + sqlServerInstance, context); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerInstanceInner> beginCreateAsync( + String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, + this.client.getContext()); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { + Response response = createWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstance); + return this.client.getLroResult(response, + SqlServerInstanceInner.class, SqlServerInstanceInner.class, Context.NONE); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context) { + Response response + = createWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context); + return this.client.getLroResult(response, + SqlServerInstanceInner.class, SqlServerInstanceInner.class, context); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance) { + return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance) { + return beginCreate(resourceGroupName, sqlServerInstanceName, sqlServerInstance).getFinalResult(); + } + + /** + * Creates or replaces a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceInner sqlServerInstance, Context context) { + return beginCreate(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context).getFinalResult(); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, parameters, + Context.NONE); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, parameters, + context); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerInstanceInner> + beginUpdateAsync(String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, + this.client.getContext()); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { + Response response = updateWithResponse(resourceGroupName, sqlServerInstanceName, parameters); + return this.client.getLroResult(response, + SqlServerInstanceInner.class, SqlServerInstanceInner.class, Context.NONE); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceInner> beginUpdate(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { + Response response + = updateWithResponse(resourceGroupName, sqlServerInstanceName, parameters, context); + return this.client.getLroResult(response, + SqlServerInstanceInner.class, SqlServerInstanceInner.class, context); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, sqlServerInstanceName, parameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters) { + return beginUpdate(resourceGroupName, sqlServerInstanceName, parameters).getFinalResult(); + } + + /** + * Updates a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param parameters The SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceUpdate parameters, Context context) { + return beginUpdate(resourceGroupName, sqlServerInstanceName, parameters, context).getFinalResult(); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlServerInstanceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, Context.NONE); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, context); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String sqlServerInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName) { + Response response = deleteWithResponse(resourceGroupName, sqlServerInstanceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, sqlServerInstanceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName) { + return beginDeleteAsync(resourceGroupName, sqlServerInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName) { + beginDelete(resourceGroupName, sqlServerInstanceName).getFinalResult(); + } + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerInstanceName, Context context) { + beginDelete(resourceGroupName, sqlServerInstanceName, context).getFinalResult(); + } + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List sqlServerInstance resources in the resource group + * + * Gets all sqlServerInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List sqlServerInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerInstance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerInstance resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List sqlServerInstance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getTelemetrySinglePageAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> { + Mono>> mono = service + .getTelemetry(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, sqlServerInstanceName, accept, sqlServerInstanceTelemetryRequest, context) + .cache(); + return Mono.zip(mono, + this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceTelemetryResponse.class, + SqlServerInstanceTelemetryResponse.class, this.client.getContext()) + .last() + .flatMap(this.client::getLroFinalResultOrError)); + }) + .>>map( + res -> new PagedResponseBase<>(res.getT1().getRequest(), res.getT1().getStatusCode(), + res.getT1().getHeaders(), res.getT2().rows(), res.getT2().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux> getTelemetryAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return new PagedFlux<>(() -> getTelemetrySinglePageAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTelemetryRequest), nextLink -> getTelemetryNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse> getTelemetrySinglePage(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + final String accept = "application/json"; + Response res = service.getTelemetrySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceTelemetryRequest, Context.NONE); + SqlServerInstanceTelemetryResponse lroPageableResult = this.client + .getLroResult(res, + SqlServerInstanceTelemetryResponse.class, SqlServerInstanceTelemetryResponse.class, Context.NONE) + .getFinalResult(); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + lroPageableResult.rows(), lroPageableResult.nextLink(), null); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse> getTelemetrySinglePage(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context) { + final String accept = "application/json"; + Response res = service.getTelemetrySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceTelemetryRequest, context); + SqlServerInstanceTelemetryResponse lroPageableResult = this.client + .getLroResult(res, + SqlServerInstanceTelemetryResponse.class, SqlServerInstanceTelemetryResponse.class, context) + .getFinalResult(); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + lroPageableResult.rows(), lroPageableResult.nextLink(), null); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return new PagedIterable<>( + () -> getTelemetrySinglePage(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest), + nextLink -> getTelemetryNextSinglePage(nextLink)); + } + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context) { + return new PagedIterable<>(() -> getTelemetrySinglePage(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTelemetryRequest, context), nextLink -> getTelemetryNextSinglePage(nextLink, context)); + } + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getBestPracticesAssessmentSinglePageAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> { + Mono>> mono + = service + .getBestPracticesAssessment(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceBpaRequest, context) + .cache(); + return Mono.zip(mono, + this.client + .getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceBpaResponse.class, + SqlServerInstanceBpaResponse.class, this.client.getContext()) + .last() + .flatMap(this.client::getLroFinalResultOrError)); + }) + .>>map( + res -> new PagedResponseBase<>(res.getT1().getRequest(), res.getT1().getStatusCode(), + res.getT1().getHeaders(), res.getT2().rows(), res.getT2().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux> getBestPracticesAssessmentAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest) { + return new PagedFlux<>(() -> getBestPracticesAssessmentSinglePageAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceBpaRequest), nextLink -> getBestPracticesAssessmentNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse> getBestPracticesAssessmentSinglePage(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest) { + final String accept = "application/json"; + Response res = service.getBestPracticesAssessmentSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + accept, sqlServerInstanceBpaRequest, Context.NONE); + SqlServerInstanceBpaResponse lroPageableResult + = this.client + .getLroResult(res, + SqlServerInstanceBpaResponse.class, SqlServerInstanceBpaResponse.class, Context.NONE) + .getFinalResult(); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + lroPageableResult.rows(), lroPageableResult.nextLink(), null); + } + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse> getBestPracticesAssessmentSinglePage(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context) { + final String accept = "application/json"; + Response res = service.getBestPracticesAssessmentSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + accept, sqlServerInstanceBpaRequest, context); + SqlServerInstanceBpaResponse lroPageableResult + = this.client + .getLroResult(res, + SqlServerInstanceBpaResponse.class, SqlServerInstanceBpaResponse.class, context) + .getFinalResult(); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + lroPageableResult.rows(), lroPageableResult.nextLink(), null); + } + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable> getBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest) { + return new PagedIterable<>(() -> getBestPracticesAssessmentSinglePage(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceBpaRequest), nextLink -> getBestPracticesAssessmentNextSinglePage(nextLink)); + } + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable> getBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context) { + return new PagedIterable<>( + () -> getBestPracticesAssessmentSinglePage(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceBpaRequest, context), + nextLink -> getBestPracticesAssessmentNextSinglePage(nextLink, context)); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + runMigrationAssessmentWithResponseAsync(String resourceGroupName, String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.runMigrationAssessment(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + runMigrationAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + return runMigrationAssessmentWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + return service.runMigrationAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); + } + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunMigrationAssessmentResponseInner runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName) { + return runMigrationAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> runTargetRecommendationJobWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.runTargetRecommendationJob(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + accept, sqlServerInstanceRunTargetRecommendationJobRequest, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runTargetRecommendationJobWithResponse(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest) { + final String accept = "application/json"; + return service.runTargetRecommendationJobSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceRunTargetRecommendationJobRequest, Context.NONE); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runTargetRecommendationJobWithResponse(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context) { + final String accept = "application/json"; + return service.runTargetRecommendationJobSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceRunTargetRecommendationJobRequest, context); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJobAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest) { + Mono>> mono = runTargetRecommendationJobWithResponseAsync(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceRunTargetRecommendationJobRequest); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceRunTargetRecommendationJobResponseInner.class, + SqlServerInstanceRunTargetRecommendationJobResponseInner.class, this.client.getContext()); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJobAsync(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest + = null; + Mono>> mono = runTargetRecommendationJobWithResponseAsync(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceRunTargetRecommendationJobRequest); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceRunTargetRecommendationJobResponseInner.class, + SqlServerInstanceRunTargetRecommendationJobResponseInner.class, this.client.getContext()); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJob(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest) { + Response response = runTargetRecommendationJobWithResponse(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest); + return this.client + .getLroResult( + response, SqlServerInstanceRunTargetRecommendationJobResponseInner.class, + SqlServerInstanceRunTargetRecommendationJobResponseInner.class, Context.NONE); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJob(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest + = null; + Response response = runTargetRecommendationJobWithResponse(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest); + return this.client + .getLroResult( + response, SqlServerInstanceRunTargetRecommendationJobResponseInner.class, + SqlServerInstanceRunTargetRecommendationJobResponseInner.class, Context.NONE); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunTargetRecommendationJobResponseInner> + beginRunTargetRecommendationJob(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context) { + Response response = runTargetRecommendationJobWithResponse(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest, context); + return this.client + .getLroResult( + response, SqlServerInstanceRunTargetRecommendationJobResponseInner.class, + SqlServerInstanceRunTargetRecommendationJobResponseInner.class, context); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runTargetRecommendationJobAsync( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest) { + return beginRunTargetRecommendationJobAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + runTargetRecommendationJobAsync(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest + = null; + return beginRunTargetRecommendationJobAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunTargetRecommendationJobResponseInner runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName) { + final SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest + = null; + return beginRunTargetRecommendationJob(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest).getFinalResult(); + } + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunTargetRecommendationJobResponseInner runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context) { + return beginRunTargetRecommendationJob(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest, context).getFinalResult(); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getTargetRecommendationReportsWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getTargetRecommendationReports(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + accept, sqlServerInstanceTargetRecommendationReportsRequest, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response getTargetRecommendationReportsWithResponse(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest) { + final String accept = "application/json"; + return service.getTargetRecommendationReportsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceTargetRecommendationReportsRequest, Context.NONE); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response getTargetRecommendationReportsWithResponse(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context) { + final String accept = "application/json"; + return service.getTargetRecommendationReportsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceTargetRecommendationReportsRequest, context); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReportsAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest) { + Mono>> mono = getTargetRecommendationReportsWithResponseAsync(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceTargetRecommendationReportsRequest); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceTargetRecommendationReportsResponseInner.class, + SqlServerInstanceTargetRecommendationReportsResponseInner.class, this.client.getContext()); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReportsAsync(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest + = null; + Mono>> mono = getTargetRecommendationReportsWithResponseAsync(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceTargetRecommendationReportsRequest); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceTargetRecommendationReportsResponseInner.class, + SqlServerInstanceTargetRecommendationReportsResponseInner.class, this.client.getContext()); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReports(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest) { + Response response = getTargetRecommendationReportsWithResponse(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceTargetRecommendationReportsRequest); + return this.client + .getLroResult( + response, SqlServerInstanceTargetRecommendationReportsResponseInner.class, + SqlServerInstanceTargetRecommendationReportsResponseInner.class, Context.NONE); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReports(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest + = null; + Response response = getTargetRecommendationReportsWithResponse(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceTargetRecommendationReportsRequest); + return this.client + .getLroResult( + response, SqlServerInstanceTargetRecommendationReportsResponseInner.class, + SqlServerInstanceTargetRecommendationReportsResponseInner.class, Context.NONE); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceTargetRecommendationReportsResponseInner> + beginGetTargetRecommendationReports(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context) { + Response response = getTargetRecommendationReportsWithResponse(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceTargetRecommendationReportsRequest, context); + return this.client + .getLroResult( + response, SqlServerInstanceTargetRecommendationReportsResponseInner.class, + SqlServerInstanceTargetRecommendationReportsResponseInner.class, context); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTargetRecommendationReportsAsync( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest) { + return beginGetTargetRecommendationReportsAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTargetRecommendationReportsRequest).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + getTargetRecommendationReportsAsync(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest + = null; + return beginGetTargetRecommendationReportsAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTargetRecommendationReportsRequest).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceTargetRecommendationReportsResponseInner + getTargetRecommendationReports(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest + = null; + return beginGetTargetRecommendationReports(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTargetRecommendationReportsRequest).getFinalResult(); + } + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceTargetRecommendationReportsResponseInner getTargetRecommendationReports( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context) { + return beginGetTargetRecommendationReports(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTargetRecommendationReportsRequest, context).getFinalResult(); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getMigrationReadinessReportWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getMigrationReadinessReport(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response getMigrationReadinessReportWithResponse(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return service.getMigrationReadinessReportSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, Context.NONE); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response getMigrationReadinessReportWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + return service.getMigrationReadinessReportSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceMigrationReadinessReportResponseInner> + beginGetMigrationReadinessReportAsync(String resourceGroupName, String sqlServerInstanceName) { + Mono>> mono + = getMigrationReadinessReportWithResponseAsync(resourceGroupName, sqlServerInstanceName); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceMigrationReadinessReportResponseInner.class, + SqlServerInstanceMigrationReadinessReportResponseInner.class, this.client.getContext()); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceMigrationReadinessReportResponseInner> + beginGetMigrationReadinessReport(String resourceGroupName, String sqlServerInstanceName) { + Response response + = getMigrationReadinessReportWithResponse(resourceGroupName, sqlServerInstanceName); + return this.client + .getLroResult( + response, SqlServerInstanceMigrationReadinessReportResponseInner.class, + SqlServerInstanceMigrationReadinessReportResponseInner.class, Context.NONE); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceMigrationReadinessReportResponseInner> + beginGetMigrationReadinessReport(String resourceGroupName, String sqlServerInstanceName, Context context) { + Response response + = getMigrationReadinessReportWithResponse(resourceGroupName, sqlServerInstanceName, context); + return this.client + .getLroResult( + response, SqlServerInstanceMigrationReadinessReportResponseInner.class, + SqlServerInstanceMigrationReadinessReportResponseInner.class, context); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + getMigrationReadinessReportAsync(String resourceGroupName, String sqlServerInstanceName) { + return beginGetMigrationReadinessReportAsync(resourceGroupName, sqlServerInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceMigrationReadinessReportResponseInner getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName) { + return beginGetMigrationReadinessReport(resourceGroupName, sqlServerInstanceName).getFinalResult(); + } + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceMigrationReadinessReportResponseInner getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return beginGetMigrationReadinessReport(resourceGroupName, sqlServerInstanceName, context).getFinalResult(); + } + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + runBestPracticesAssessmentWithResponseAsync(String resourceGroupName, String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.runBestPracticesAssessment(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + runBestPracticesAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + return runBestPracticesAssessmentWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response runBestPracticesAssessmentWithResponse( + String resourceGroupName, String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + return service.runBestPracticesAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); + } + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunBestPracticesAssessmentResponseInner runBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName) { + return runBestPracticesAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE) + .getValue(); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> runBestPracticeAssessmentWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.runBestPracticeAssessment(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runBestPracticeAssessmentWithResponse(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return service.runBestPracticeAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, Context.NONE); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runBestPracticeAssessmentWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + return service.runBestPracticeAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceRunBestPracticesAssessmentResponseInner> + beginRunBestPracticeAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + Mono>> mono + = runBestPracticeAssessmentWithResponseAsync(resourceGroupName, sqlServerInstanceName); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceRunBestPracticesAssessmentResponseInner.class, + SqlServerInstanceRunBestPracticesAssessmentResponseInner.class, this.client.getContext()); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunBestPracticesAssessmentResponseInner> + beginRunBestPracticeAssessment(String resourceGroupName, String sqlServerInstanceName) { + Response response = runBestPracticeAssessmentWithResponse(resourceGroupName, sqlServerInstanceName); + return this.client + .getLroResult( + response, SqlServerInstanceRunBestPracticesAssessmentResponseInner.class, + SqlServerInstanceRunBestPracticesAssessmentResponseInner.class, Context.NONE); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunBestPracticesAssessmentResponseInner> + beginRunBestPracticeAssessment(String resourceGroupName, String sqlServerInstanceName, Context context) { + Response response + = runBestPracticeAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + return this.client + .getLroResult( + response, SqlServerInstanceRunBestPracticesAssessmentResponseInner.class, + SqlServerInstanceRunBestPracticesAssessmentResponseInner.class, context); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + runBestPracticeAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + return beginRunBestPracticeAssessmentAsync(resourceGroupName, sqlServerInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunBestPracticesAssessmentResponseInner runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName) { + return beginRunBestPracticeAssessment(resourceGroupName, sqlServerInstanceName).getFinalResult(); + } + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunBestPracticesAssessmentResponseInner runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName, Context context) { + return beginRunBestPracticeAssessment(resourceGroupName, sqlServerInstanceName, context).getFinalResult(); + } + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> runMigrationReadinessAssessmentWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.runMigrationReadinessAssessment(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runMigrationReadinessAssessmentWithResponse(String resourceGroupName, + String sqlServerInstanceName) { + final String accept = "application/json"; + return service.runMigrationReadinessAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, Context.NONE); + } + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runMigrationReadinessAssessmentWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + final String accept = "application/json"; + return service.runMigrationReadinessAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); + } + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private + PollerFlux, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner> + beginRunMigrationReadinessAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + Mono>> mono + = runMigrationReadinessAssessmentWithResponseAsync(resourceGroupName, sqlServerInstanceName); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class, + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class, this.client.getContext()); } /** - * List sqlServerInstance resources in the subscription. + * The request to run migration readiness assessment asynchronously. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner> + beginRunMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName) { + Response response + = runMigrationReadinessAssessmentWithResponse(resourceGroupName, sqlServerInstanceName); + return this.client + .getLroResult( + response, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class, + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class, Context.NONE); } /** - * List sqlServerInstance resources in the subscription. + * The request to run migration readiness assessment asynchronously. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public + SyncPoller, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner> + beginRunMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName, Context context) { + Response response + = runMigrationReadinessAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + return this.client + .getLroResult( + response, SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class, + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class, context); + } + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + private Mono + runMigrationReadinessAssessmentAsync(String resourceGroupName, String sqlServerInstanceName) { + return beginRunMigrationReadinessAssessmentAsync(resourceGroupName, sqlServerInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * List sqlServerInstance resources in the subscription. + * The request to run migration readiness assessment asynchronously. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedFlux}. + * @return the response. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunMigrationReadinessAssessmentResponseInner + runMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName) { + return beginRunMigrationReadinessAssessment(resourceGroupName, sqlServerInstanceName).getFinalResult(); } /** - * List sqlServerInstance resources in the subscription. + * The request to run migration readiness assessment asynchronously. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedFlux}. + * @return the response. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceRunMigrationReadinessAssessmentResponseInner + runMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName, Context context) { + return beginRunMigrationReadinessAssessment(resourceGroupName, sqlServerInstanceName, context).getFinalResult(); } /** - * List sqlServerInstance resources in the subscription. + * Gets jobs status details for sql arc resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + * @return jobs status details for sql arc resource along with {@link Response} on successful completion of + * {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getJobsStatusWithResponseAsync( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getJobsStatus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceJobsStatusRequest, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List sqlServerInstance resources in the subscription. + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getJobsStatusAsync(String resourceGroupName, + String sqlServerInstanceName) { + final SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest = null; + return getJobsStatusWithResponseAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceJobsStatusRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets jobs status details for sql arc resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + * @return jobs status details for sql arc resource along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context) { + final String accept = "application/json"; + return service.getJobsStatusSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceJobsStatusRequest, context); } /** - * List sqlServerInstance resources in the resource group + * Gets jobs status details for sql arc resource. * - * Gets all sqlServerInstances in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceJobsStatusResponseInner getJobsStatus(String resourceGroupName, + String sqlServerInstanceName) { + final SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest = null; + return getJobsStatusWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsStatusRequest, + Context.NONE).getValue(); + } + + /** + * Gets job details for sql arc resource asynchronously. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group along with {@link PagedResponse} on successful completion of + * @return job details for sql arc resource asynchronously along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } + private Mono>> getJobsWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), - this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .withContext(context -> service.getJobs(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceJobsRequest, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List sqlServerInstance resources in the resource group + * Gets job details for sql arc resource asynchronously. * - * Gets all sqlServerInstances in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response getJobsWithResponse(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest) { + final String accept = "application/json"; + return service.getJobsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceJobsRequest, Context.NONE); + } + + /** + * Gets job details for sql arc resource asynchronously. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return job details for sql arc resource asynchronously along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + private Response getJobsWithResponse(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context) { + final String accept = "application/json"; + return service.getJobsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, + sqlServerInstanceJobsRequest, context); } /** - * List sqlServerInstance resources in the resource group + * Gets job details for sql arc resource asynchronously. * - * Gets all sqlServerInstances in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerInstanceJobsResponseInner> + beginGetJobsAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest) { + Mono>> mono + = getJobsWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceJobsResponseInner.class, + SqlServerInstanceJobsResponseInner.class, this.client.getContext()); + } + + /** + * Gets job details for sql arc resource asynchronously. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedFlux}. + * @return the {@link PollerFlux} for polling of job details for sql arc resource asynchronously. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SqlServerInstanceJobsResponseInner> + beginGetJobsAsync(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest = null; + Mono>> mono + = getJobsWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SqlServerInstanceJobsResponseInner.class, + SqlServerInstanceJobsResponseInner.class, this.client.getContext()); } /** - * List sqlServerInstance resources in the resource group + * Gets job details for sql arc resource asynchronously. * - * Gets all sqlServerInstances in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceJobsResponseInner> beginGetJobs( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest) { + Response response + = getJobsWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest); + return this.client.getLroResult( + response, SqlServerInstanceJobsResponseInner.class, SqlServerInstanceJobsResponseInner.class, Context.NONE); + } + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceJobsResponseInner> + beginGetJobs(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest = null; + Response response + = getJobsWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest); + return this.client.getLroResult( + response, SqlServerInstanceJobsResponseInner.class, SqlServerInstanceJobsResponseInner.class, Context.NONE); + } + + /** + * Gets job details for sql arc resource asynchronously. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedFlux}. + * @return the {@link SyncPoller} for polling of job details for sql arc resource asynchronously. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SqlServerInstanceJobsResponseInner> beginGetJobs( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context) { + Response response + = getJobsWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest, context); + return this.client.getLroResult( + response, SqlServerInstanceJobsResponseInner.class, SqlServerInstanceJobsResponseInner.class, context); } /** - * List sqlServerInstance resources in the resource group + * Gets job details for sql arc resource asynchronously. * - * Gets all sqlServerInstances in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getJobsAsync(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest) { + return beginGetJobsAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets job details for sql arc resource asynchronously. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedIterable}. + * @return job details for sql arc resource asynchronously on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getJobsAsync(String resourceGroupName, + String sqlServerInstanceName) { + final SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest = null; + return beginGetJobsAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * List sqlServerInstance resources in the resource group + * Gets job details for sql arc resource asynchronously. * - * Gets all sqlServerInstances in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceJobsResponseInner getJobs(String resourceGroupName, String sqlServerInstanceName) { + final SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest = null; + return beginGetJobs(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest).getFinalResult(); + } + + /** + * Gets job details for sql arc resource asynchronously. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedIterable}. + * @return job details for sql arc resource asynchronously. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerInstanceJobsResponseInner getJobs(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context) { + return beginGetJobs(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest, context) + .getFinalResult(); } /** - * Retrieves a SQL Server Instance resource. + * Request Upgrade Permission before upgrading. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -408,89 +3386,105 @@ public PagedIterable listByResourceGroup(String resource * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + private Mono> preUpgradeWithResponseAsync(String resourceGroupName, String sqlServerInstanceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) + .withContext(context -> service.preUpgrade(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Retrieves a SQL Server Instance resource. + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono preUpgradeAsync(String resourceGroupName, String sqlServerInstanceName) { + return preUpgradeWithResponseAsync(resourceGroupName, sqlServerInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Request Upgrade Permission before upgrading. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + * @return a SqlServerInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + public Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlServerInstanceName, this.client.getApiVersion(), accept, context); + final String accept = "application/json"; + return service.preUpgradeSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); } /** - * Retrieves a SQL Server Instance resource. + * Request Upgrade Permission before upgrading. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance on successful completion of {@link Mono}. + * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, + public SqlServerInstanceInner preUpgrade(String resourceGroupName, String sqlServerInstanceName) { + return preUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postUpgradeWithResponseAsync(String resourceGroupName, String sqlServerInstanceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName) + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.postUpgrade(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Clean up after upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postUpgradeAsync(String resourceGroupName, String sqlServerInstanceName) { + return postUpgradeWithResponseAsync(resourceGroupName, sqlServerInstanceName) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Retrieves a SQL Server Instance resource. + * Clean up after upgrading. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -499,15 +3493,17 @@ private Mono getByResourceGroupAsync(String resourceGrou * @return a SqlServerInstance along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, + public Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerInstanceName, context).block(); + final String accept = "application/json"; + return service.postUpgradeSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, accept, context); } /** - * Retrieves a SQL Server Instance resource. + * Clean up after upgrading. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -515,640 +3511,631 @@ public Response getByResourceGroupWithResponse(String re * @return a SqlServerInstance. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner getByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { - return getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); + public SqlServerInstanceInner postUpgrade(String resourceGroupName, String sqlServerInstanceName) { + return postUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, Context.NONE).getValue(); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } - if (sqlServerInstance == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstance is required and cannot be null.")); - } else { - sqlServerInstance.validate(); - } + private Mono>> runManagedInstanceLinkAssessmentWithResponseAsync(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstance, accept, context)) + .withContext(context -> service.runManagedInstanceLinkAssessment(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + contentType, accept, sqlServerInstanceManagedInstanceLinkAssessmentRequest, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runManagedInstanceLinkAssessmentWithResponse(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.runManagedInstanceLinkAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + sqlServerInstanceManagedInstanceLinkAssessmentRequest, Context.NONE); + } + + /** + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } - if (sqlServerInstance == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstance is required and cannot be null.")); - } else { - sqlServerInstance.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlServerInstanceName, this.client.getApiVersion(), sqlServerInstance, accept, context); + private Response runManagedInstanceLinkAssessmentWithResponse(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.runManagedInstanceLinkAssessmentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, contentType, accept, + sqlServerInstanceManagedInstanceLinkAssessmentRequest, context); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of a SqlServerInstance. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, SqlServerInstanceInner> beginCreateAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { - Mono>> mono - = createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, - this.client.getContext()); + private + PollerFlux, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner> + beginRunManagedInstanceLinkAssessmentAsync(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + Mono>> mono = runManagedInstanceLinkAssessmentWithResponseAsync(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceManagedInstanceLinkAssessmentRequest); + return this.client + .getLroResult( + mono, this.client.getHttpPipeline(), SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class, + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class, this.client.getContext()); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of a SqlServerInstance. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, SqlServerInstanceInner> beginCreateAsync( - String resourceGroupName, String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = createWithResponseAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SqlServerInstanceInner.class, SqlServerInstanceInner.class, context); + public + SyncPoller, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner> + beginRunManagedInstanceLinkAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + Response response = runManagedInstanceLinkAssessmentWithResponse(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceManagedInstanceLinkAssessmentRequest); + return this.client + .getLroResult( + response, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class, + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class, Context.NONE); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of a SqlServerInstance. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance) { - return this.beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).getSyncPoller(); + public + SyncPoller, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner> + beginRunManagedInstanceLinkAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context) { + Response response = runManagedInstanceLinkAssessmentWithResponse(resourceGroupName, + sqlServerInstanceName, sqlServerInstanceManagedInstanceLinkAssessmentRequest, context); + return this.client + .getLroResult( + response, SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class, + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class, context); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of a SqlServerInstance. + * @return the response body on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, SqlServerInstanceInner> beginCreate(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceInner sqlServerInstance, Context context) { - return this.beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context) - .getSyncPoller(); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runManagedInstanceLinkAssessmentAsync( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + return beginRunManagedInstanceLinkAssessmentAsync(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance on successful completion of {@link Mono}. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance) { - return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).last() - .flatMap(this.client::getLroFinalResultOrError); + public SqlServerInstanceManagedInstanceLinkAssessmentResponseInner runManagedInstanceLinkAssessment( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + return beginRunManagedInstanceLinkAssessment(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest).getFinalResult(); } /** - * Creates or replaces a SQL Server Instance resource. + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance on successful completion of {@link Mono}. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, Context context) { - return beginCreateAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context).last() - .flatMap(this.client::getLroFinalResultOrError); + public SqlServerInstanceManagedInstanceLinkAssessmentResponseInner runManagedInstanceLinkAssessment( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context) { + return beginRunManagedInstanceLinkAssessment(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest, context).getFinalResult(); } /** - * Creates or replaces a SQL Server Instance resource. + * Retrieves full properties of all the Availability Groups in a SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance) { - return createAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance).block(); + private Mono> getAllAvailabilityGroupsSinglePageAsync( + String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAllAvailabilityGroups(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, + accept, availabilityGroupRetrievalFilters, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Creates or replaces a SQL Server Instance resource. + * Retrieves full properties of all the Availability Groups in a SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param sqlServerInstance The SQL Server Instance to be created or updated. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner create(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceInner sqlServerInstance, Context context) { - return createAsync(resourceGroupName, sqlServerInstanceName, sqlServerInstance, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getAllAvailabilityGroupsAsync(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters) { + return new PagedFlux<>(() -> getAllAvailabilityGroupsSinglePageAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupRetrievalFilters), nextLink -> getAllAvailabilityGroupsNextSinglePageAsync(nextLink)); } /** - * Deletes a SQL Server Instance resource. + * Retrieves full properties of all the Availability Groups in a SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux getAllAvailabilityGroupsAsync(String resourceGroupName, String sqlServerInstanceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } + final AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters = null; + return new PagedFlux<>(() -> getAllAvailabilityGroupsSinglePageAsync(resourceGroupName, sqlServerInstanceName, + availabilityGroupRetrievalFilters), nextLink -> getAllAvailabilityGroupsNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse getAllAvailabilityGroupsSinglePage( + String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters) { final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + Response res = service.getAllAvailabilityGroupsSync( + this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, accept, availabilityGroupRetrievalFilters, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Deletes a SQL Server Instance resource. + * Retrieves full properties of all the Availability Groups in a SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, - String sqlServerInstanceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlServerInstanceName, this.client.getApiVersion(), accept, context); + private PagedResponse getAllAvailabilityGroupsSinglePage( + String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, Context context) { + final String accept = "application/json"; + Response res = service.getAllAvailabilityGroupsSync( + this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + sqlServerInstanceName, accept, availabilityGroupRetrievalFilters, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Deletes a SQL Server Instance resource. + * Retrieves full properties of all the Availability Groups in a SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getAllAvailabilityGroups(String resourceGroupName, String sqlServerInstanceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + final AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters = null; + return new PagedIterable<>(() -> getAllAvailabilityGroupsSinglePage(resourceGroupName, sqlServerInstanceName, + availabilityGroupRetrievalFilters), nextLink -> getAllAvailabilityGroupsNextSinglePage(nextLink)); } /** - * Deletes a SQL Server Instance resource. + * Retrieves full properties of all the Availability Groups in a SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String sqlServerInstanceName, + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, sqlServerInstanceName, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + return new PagedIterable<>( + () -> getAllAvailabilityGroupsSinglePage(resourceGroupName, sqlServerInstanceName, + availabilityGroupRetrievalFilters, context), + nextLink -> getAllAvailabilityGroupsNextSinglePage(nextLink, context)); } /** - * Deletes a SQL Server Instance resource. + * List sqlServerInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName) { - return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName).getSyncPoller(); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Deletes a SQL Server Instance resource. + * List sqlServerInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param context The context to associate with this operation. + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return a list of SqlServerInstance along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlServerInstanceName, - Context context) { - return this.beginDeleteAsync(resourceGroupName, sqlServerInstanceName, context).getSyncPoller(); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Deletes a SQL Server Instance resource. + * List sqlServerInstance resources in the resource group + * + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * @return a list of SqlServerInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName) { - return beginDeleteAsync(resourceGroupName, sqlServerInstanceName).last() - .flatMap(this.client::getLroFinalResultOrError); + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Deletes a SQL Server Instance resource. + * List sqlServerInstance resources in the subscription * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. - * @param context The context to associate with this operation. + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String sqlServerInstanceName, Context context) { - return beginDeleteAsync(resourceGroupName, sqlServerInstanceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Deletes a SQL Server Instance resource. + * List sqlServerInstance resources in the subscription + * + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String sqlServerInstanceName) { - deleteAsync(resourceGroupName, sqlServerInstanceName).block(); + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Deletes a SQL Server Instance resource. + * List sqlServerInstance resources in the subscription * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String sqlServerInstanceName, Context context) { - deleteAsync(resourceGroupName, sqlServerInstanceName, context).block(); + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Updates a SQL Server Instance resource. + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceUpdate parameters) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + private Mono>> getTelemetryNextSinglePageAsync(String nextLink) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), parameters, accept, context)) + .withContext(context -> service.getTelemetryNext(nextLink, this.client.getEndpoint(), accept, context)) + .>>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().rows(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a SQL Server Instance resource. + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. - * @param context The context to associate with this operation. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - String sqlServerInstanceName, SqlServerInstanceUpdate parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (sqlServerInstanceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - sqlServerInstanceName, this.client.getApiVersion(), parameters, accept, context); + private PagedResponse> getTelemetryNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.getTelemetryNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().rows(), + res.getValue().nextLink(), null); } /** - * Updates a SQL Server Instance resource. + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance on successful completion of {@link Mono}. + * @return the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceUpdate parameters) { - return updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private PagedResponse> getTelemetryNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.getTelemetryNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().rows(), + res.getValue().nextLink(), null); } /** - * Updates a SQL Server Instance resource. + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. - * @param context The context to associate with this operation. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance along with {@link Response}. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceUpdate parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, sqlServerInstanceName, parameters, context).block(); + private Mono>> getBestPracticesAssessmentNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getBestPracticesAssessmentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().rows(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a SQL Server Instance resource. + * Get the next page of items. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName Name of sqlServerInstance. - * @param parameters The SQL Server Instance. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlServerInstance. + * @return the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SqlServerInstanceInner update(String resourceGroupName, String sqlServerInstanceName, - SqlServerInstanceUpdate parameters) { - return updateWithResponse(resourceGroupName, sqlServerInstanceName, parameters, Context.NONE).getValue(); + private PagedResponse> getBestPracticesAssessmentNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.getBestPracticesAssessmentNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().rows(), + res.getValue().nextLink(), null); } /** * Get the next page of items. * * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the response body along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private PagedResponse> getBestPracticesAssessmentNextSinglePage(String nextLink, Context context) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + Response res + = service.getBestPracticesAssessmentNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().rows(), + res.getValue().nextLink(), null); } /** * Get the next page of items. * * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private Mono> + getAllAvailabilityGroupsNextSinglePageAsync(String nextLink) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return FluxUtil + .withContext( + context -> service.getAllAvailabilityGroupsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1158,24 +4145,16 @@ private Mono> listNextSinglePageAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } + private PagedResponse + getAllAvailabilityGroupsNextSinglePage(String nextLink) { final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + Response res + = service.getAllAvailabilityGroupsNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1186,22 +4165,15 @@ private Mono> listByResourceGroupNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return a list of Arc Sql Server Availability Groups along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, - Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + private PagedResponse + getAllAvailabilityGroupsNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.getAllAvailabilityGroupsNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java index 67a5370df85d..0cd9898c5a7e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.implementation; @@ -10,9 +10,38 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceMigrationReadinessReportResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunBestPracticesAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationReadinessAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstances; +import java.util.List; public final class SqlServerInstancesImpl implements SqlServerInstances { private static final ClientLogger LOGGER = new ClientLogger(SqlServerInstancesImpl.class); @@ -27,14 +56,30 @@ public SqlServerInstancesImpl(SqlServerInstancesClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerInstanceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceImpl(inner.getValue(), this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + public SqlServerInstance getByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName); + } + + public void delete(String resourceGroupName, String sqlServerInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, context); } public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -48,21 +93,262 @@ public PagedIterable listByResourceGroup(String resourceGroup return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); } - public Response getByResourceGroupWithResponse(String resourceGroupName, + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerInstanceImpl(inner1, this.manager())); + } + + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest) { + return this.serviceClient() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest); + } + + public PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context) { + return this.serviceClient() + .getTelemetry(resourceGroupName, sqlServerInstanceName, sqlServerInstanceTelemetryRequest, context); + } + + public PagedIterable> getBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest) { + return this.serviceClient() + .getBestPracticesAssessment(resourceGroupName, sqlServerInstanceName, sqlServerInstanceBpaRequest); + } + + public PagedIterable> getBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context) { + return this.serviceClient() + .getBestPracticesAssessment(resourceGroupName, sqlServerInstanceName, sqlServerInstanceBpaRequest, context); + } + + public Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context) { + Response inner = this.serviceClient() + .runMigrationAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceRunMigrationAssessmentResponseImpl(inner.getValue(), this.manager())); + } + + public SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceRunMigrationAssessmentResponseInner inner + = this.serviceClient().runMigrationAssessment(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceRunMigrationAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceRunTargetRecommendationJobResponseInner inner + = this.serviceClient().runTargetRecommendationJob(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceRunTargetRecommendationJobResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context) { + SqlServerInstanceRunTargetRecommendationJobResponseInner inner = this.serviceClient() + .runTargetRecommendationJob(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceRunTargetRecommendationJobRequest, context); + if (inner != null) { + return new SqlServerInstanceRunTargetRecommendationJobResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceTargetRecommendationReportsResponseInner inner + = this.serviceClient().getTargetRecommendationReports(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceTargetRecommendationReportsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context) { + SqlServerInstanceTargetRecommendationReportsResponseInner inner = this.serviceClient() + .getTargetRecommendationReports(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceTargetRecommendationReportsRequest, context); + if (inner != null) { + return new SqlServerInstanceTargetRecommendationReportsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceMigrationReadinessReportResponseInner inner + = this.serviceClient().getMigrationReadinessReport(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceMigrationReadinessReportResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName, Context context) { + SqlServerInstanceMigrationReadinessReportResponseInner inner + = this.serviceClient().getMigrationReadinessReport(resourceGroupName, sqlServerInstanceName, context); + if (inner != null) { + return new SqlServerInstanceMigrationReadinessReportResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response runBestPracticesAssessmentWithResponse( + String resourceGroupName, String sqlServerInstanceName, Context context) { + Response inner = this.serviceClient() + .runBestPracticesAssessmentWithResponse(resourceGroupName, sqlServerInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceRunBestPracticesAssessmentResponseImpl(inner.getValue(), this.manager())); + } + + public SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceRunBestPracticesAssessmentResponseInner inner + = this.serviceClient().runBestPracticesAssessment(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceRunBestPracticesAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName) { + SqlServerInstanceRunBestPracticesAssessmentResponseInner inner + = this.serviceClient().runBestPracticeAssessment(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceRunBestPracticesAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(String resourceGroupName, String sqlServerInstanceName, Context context) { + SqlServerInstanceRunBestPracticesAssessmentResponseInner inner + = this.serviceClient().runBestPracticeAssessment(resourceGroupName, sqlServerInstanceName, context); + if (inner != null) { + return new SqlServerInstanceRunBestPracticesAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceRunMigrationReadinessAssessmentResponse + runMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner inner + = this.serviceClient().runMigrationReadinessAssessment(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceRunMigrationReadinessAssessmentResponse + runMigrationReadinessAssessment(String resourceGroupName, String sqlServerInstanceName, Context context) { + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner inner + = this.serviceClient().runMigrationReadinessAssessment(resourceGroupName, sqlServerInstanceName, context); + if (inner != null) { + return new SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context) { + Response inner = this.serviceClient() + .getJobsStatusWithResponse(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsStatusRequest, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceJobsStatusResponseImpl(inner.getValue(), this.manager())); + } + + public SqlServerInstanceJobsStatusResponse getJobsStatus(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceJobsStatusResponseInner inner + = this.serviceClient().getJobsStatus(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceJobsStatusResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceJobsResponse getJobs(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceJobsResponseInner inner + = this.serviceClient().getJobs(resourceGroupName, sqlServerInstanceName); + if (inner != null) { + return new SqlServerInstanceJobsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlServerInstanceJobsResponse getJobs(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context) { + SqlServerInstanceJobsResponseInner inner = this.serviceClient() + .getJobs(resourceGroupName, sqlServerInstanceName, sqlServerInstanceJobsRequest, context); + if (inner != null) { + return new SqlServerInstanceJobsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context) { Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerInstanceName, context); + = this.serviceClient().preUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceImpl(inner.getValue(), this.manager())); + } + + public SqlServerInstance preUpgrade(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceInner inner = this.serviceClient().preUpgrade(resourceGroupName, sqlServerInstanceName); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SqlServerInstanceImpl(inner.getValue(), this.manager())); + return new SqlServerInstanceImpl(inner, this.manager()); } else { return null; } } - public SqlServerInstance getByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { - SqlServerInstanceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerInstanceName); + public Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context) { + Response inner + = this.serviceClient().postUpgradeWithResponse(resourceGroupName, sqlServerInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerInstanceImpl(inner.getValue(), this.manager())); + } + + public SqlServerInstance postUpgrade(String resourceGroupName, String sqlServerInstanceName) { + SqlServerInstanceInner inner = this.serviceClient().postUpgrade(resourceGroupName, sqlServerInstanceName); if (inner != null) { return new SqlServerInstanceImpl(inner, this.manager()); } else { @@ -70,12 +356,49 @@ public SqlServerInstance getByResourceGroup(String resourceGroupName, String sql } } - public void deleteByResourceGroup(String resourceGroupName, String sqlServerInstanceName) { - this.serviceClient().delete(resourceGroupName, sqlServerInstanceName); + public SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest) { + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner inner = this.serviceClient() + .runManagedInstanceLinkAssessment(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest); + if (inner != null) { + return new SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } } - public void delete(String resourceGroupName, String sqlServerInstanceName, Context context) { - this.serviceClient().delete(resourceGroupName, sqlServerInstanceName, context); + public SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment( + String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context) { + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner inner = this.serviceClient() + .runManagedInstanceLinkAssessment(resourceGroupName, sqlServerInstanceName, + sqlServerInstanceManagedInstanceLinkAssessmentRequest, context); + if (inner != null) { + return new SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName) { + PagedIterable inner + = this.serviceClient().getAllAvailabilityGroups(resourceGroupName, sqlServerInstanceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, + Context context) { + PagedIterable inner = this.serviceClient() + .getAllAvailabilityGroups(resourceGroupName, sqlServerInstanceName, availabilityGroupRetrievalFilters, + context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new SqlServerAvailabilityGroupResourceImpl(inner1, this.manager())); } public SqlServerInstance getById(String id) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java new file mode 100644 index 000000000000..82e46802fb29 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class SqlServerLicenseImpl + implements SqlServerLicense, SqlServerLicense.Definition, SqlServerLicense.Update { + private SqlServerLicenseInner innerObject; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SqlServerLicenseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlServerLicenseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String sqlServerLicenseName; + + private SqlServerLicenseUpdate updateParameters; + + public SqlServerLicenseImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SqlServerLicense create() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .createWithResponse(resourceGroupName, sqlServerLicenseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlServerLicense create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .createWithResponse(resourceGroupName, sqlServerLicenseName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlServerLicenseImpl(String name, com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = new SqlServerLicenseInner(); + this.serviceManager = serviceManager; + this.sqlServerLicenseName = name; + } + + public SqlServerLicenseImpl update() { + this.updateParameters = new SqlServerLicenseUpdate(); + return this; + } + + public SqlServerLicense apply() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .updateWithResponse(resourceGroupName, sqlServerLicenseName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public SqlServerLicense apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .updateWithResponse(resourceGroupName, sqlServerLicenseName, updateParameters, context) + .getValue(); + return this; + } + + SqlServerLicenseImpl(SqlServerLicenseInner innerObject, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "sqlServerLicenses"); + } + + public SqlServerLicense refresh() { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE) + .getValue(); + return this; + } + + public SqlServerLicense refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSqlServerLicenses() + .getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context) + .getValue(); + return this; + } + + public SqlServerLicenseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SqlServerLicenseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SqlServerLicenseImpl withProperties(SqlServerLicenseProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SqlServerLicenseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public SqlServerLicenseImpl withProperties(SqlServerLicenseUpdateProperties properties) { + this.updateParameters.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java new file mode 100644 index 000000000000..156b0ec862c4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java @@ -0,0 +1,841 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerLicenseListResult; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlServerLicensesClient. + */ +public final class SqlServerLicensesClientImpl implements SqlServerLicensesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SqlServerLicensesService service; + + /** + * The service client containing this operation class. + */ + private final AzureArcDataManagementClientImpl client; + + /** + * Initializes an instance of SqlServerLicensesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlServerLicensesClientImpl(AzureArcDataManagementClientImpl client) { + this.service + = RestProxy.create(SqlServerLicensesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureArcDataManagementClientSqlServerLicenses to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureArcDataManagementClientSqlServerLicenses") + public interface SqlServerLicensesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerLicenseInner sqlServerLicense, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerLicenseInner sqlServerLicense, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerLicenseUpdate parameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SqlServerLicenseUpdate parameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses/{sqlServerLicenseName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlServerLicenseName") String sqlServerLicenseName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerLicenses") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String sqlServerLicenseName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, sqlServerLicenseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerLicenseName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, accept, context); + } + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerLicenseInner getByResourceGroup(String resourceGroupName, String sqlServerLicenseName) { + return getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, SqlServerLicenseInner sqlServerLicense) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, contentType, accept, + sqlServerLicense, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense) { + return createWithResponseAsync(resourceGroupName, sqlServerLicenseName, sqlServerLicense) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, contentType, accept, + sqlServerLicense, context); + } + + /** + * Creates or replaces a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param sqlServerLicense The SQL Server license to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerLicenseInner create(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseInner sqlServerLicense) { + return createWithResponse(resourceGroupName, sqlServerLicenseName, sqlServerLicense, Context.NONE).getValue(); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String sqlServerLicenseName, SqlServerLicenseUpdate parameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, contentType, accept, + parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, sqlServerLicenseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, contentType, accept, parameters, + context); + } + + /** + * Updates a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param parameters The SQL Server license. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlServerLicenseInner update(String resourceGroupName, String sqlServerLicenseName, + SqlServerLicenseUpdate parameters) { + return updateWithResponse(resourceGroupName, sqlServerLicenseName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String sqlServerLicenseName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String sqlServerLicenseName) { + return deleteWithResponseAsync(resourceGroupName, sqlServerLicenseName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String sqlServerLicenseName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, sqlServerLicenseName, context); + } + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String sqlServerLicenseName) { + deleteWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List sqlServerLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sqlServerLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List sqlServerLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List sqlServerLicense resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List sqlServerLicense resources in the subscription + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java new file mode 100644 index 000000000000..9c891f9c872c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenses; + +public final class SqlServerLicensesImpl implements SqlServerLicenses { + private static final ClientLogger LOGGER = new ClientLogger(SqlServerLicensesImpl.class); + + private final SqlServerLicensesClient innerClient; + + private final com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager; + + public SqlServerLicensesImpl(SqlServerLicensesClient innerClient, + com.azure.resourcemanager.azurearcdata.AzureArcDataManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerLicenseName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SqlServerLicenseImpl(inner.getValue(), this.manager())); + } + + public SqlServerLicense getByResourceGroup(String resourceGroupName, String sqlServerLicenseName) { + SqlServerLicenseInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, sqlServerLicenseName); + if (inner != null) { + return new SqlServerLicenseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerLicenseName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, sqlServerLicenseName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String sqlServerLicenseName) { + this.serviceClient().delete(resourceGroupName, sqlServerLicenseName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SqlServerLicenseImpl(inner1, this.manager())); + } + + public SqlServerLicense getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String sqlServerLicenseName = ResourceManagerUtils.getValueFromIdByName(id, "sqlServerLicenses"); + if (sqlServerLicenseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sqlServerLicenses'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, sqlServerLicenseName, context); + } + + private SqlServerLicensesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager() { + return this.serviceManager; + } + + public SqlServerLicenseImpl define(String name) { + return new SqlServerLicenseImpl(name, this.manager()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ActiveDirectoryConnectorListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ActiveDirectoryConnectorListResult.java new file mode 100644 index 000000000000..07d6ecad3884 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ActiveDirectoryConnectorListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of active directory connectors. + */ +@Immutable +public final class ActiveDirectoryConnectorListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ActiveDirectoryConnectorListResult class. + */ + private ActiveDirectoryConnectorListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorListResult. + */ + public static ActiveDirectoryConnectorListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorListResult deserializedActiveDirectoryConnectorListResult + = new ActiveDirectoryConnectorListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ActiveDirectoryConnectorResourceInner.fromJson(reader1)); + deserializedActiveDirectoryConnectorListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedActiveDirectoryConnectorListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerAvailabilityGroupListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerAvailabilityGroupListResult.java new file mode 100644 index 000000000000..2bd0ba0a3244 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerAvailabilityGroupListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of Arc Sql Server Availability Groups. + */ +@Immutable +public final class ArcSqlServerAvailabilityGroupListResult + implements JsonSerializable { + /* + * Array of Arc Sql Server Availability Groups. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ArcSqlServerAvailabilityGroupListResult class. + */ + private ArcSqlServerAvailabilityGroupListResult() { + } + + /** + * Get the value property: Array of Arc Sql Server Availability Groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcSqlServerAvailabilityGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcSqlServerAvailabilityGroupListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcSqlServerAvailabilityGroupListResult. + */ + public static ArcSqlServerAvailabilityGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcSqlServerAvailabilityGroupListResult deserializedArcSqlServerAvailabilityGroupListResult + = new ArcSqlServerAvailabilityGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerAvailabilityGroupResourceInner.fromJson(reader1)); + deserializedArcSqlServerAvailabilityGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedArcSqlServerAvailabilityGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArcSqlServerAvailabilityGroupListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerDatabaseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerDatabaseListResult.java new file mode 100644 index 000000000000..73b5a6505e3f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerDatabaseListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of Arc Sql Server database. + */ +@Immutable +public final class ArcSqlServerDatabaseListResult implements JsonSerializable { + /* + * Array of Arc Sql Server database. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of ArcSqlServerDatabaseListResult class. + */ + private ArcSqlServerDatabaseListResult() { + } + + /** + * Get the value property: Array of Arc Sql Server database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcSqlServerDatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcSqlServerDatabaseListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcSqlServerDatabaseListResult. + */ + public static ArcSqlServerDatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcSqlServerDatabaseListResult deserializedArcSqlServerDatabaseListResult + = new ArcSqlServerDatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerDatabaseResourceInner.fromJson(reader1)); + deserializedArcSqlServerDatabaseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedArcSqlServerDatabaseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArcSqlServerDatabaseListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/FailoverGroupListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/FailoverGroupListResult.java new file mode 100644 index 000000000000..9d6395c80607 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/FailoverGroupListResult.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of failover groups. + */ +@Immutable +public final class FailoverGroupListResult implements JsonSerializable { + /* + * Array of failover group results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of FailoverGroupListResult class. + */ + private FailoverGroupListResult() { + } + + /** + * Get the value property: Array of failover group results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FailoverGroupListResult. + */ + public static FailoverGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupListResult deserializedFailoverGroupListResult = new FailoverGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> FailoverGroupResourceInner.fromJson(reader1)); + deserializedFailoverGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFailoverGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverGroupListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/OperationListResult.java similarity index 87% rename from sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java rename to sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/OperationListResult.java index b0102ac2b87e..a8cc40d62585 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationListResult.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/OperationListResult.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.azurearcdata.models; +package com.azure.resourcemanager.azurearcdata.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class OperationListResult implements JsonSerializable e.validate()); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PageOfDataControllerResource.java similarity index 69% rename from sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java rename to sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PageOfDataControllerResource.java index 4a0297b491d6..cd16c5a8cb4c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PageOfDataControllerResource.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PageOfDataControllerResource.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.azurearcdata.models; +package com.azure.resourcemanager.azurearcdata.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,12 +14,12 @@ import java.util.List; /** - * The PageOfDataControllerResource model. + * A list of data controllers. */ -@Fluent +@Immutable public final class PageOfDataControllerResource implements JsonSerializable { /* - * The value property. + * Array of results. */ private List value; @@ -31,11 +31,11 @@ public final class PageOfDataControllerResource implements JsonSerializable value() { return this.value; } - /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the PageOfDataControllerResource object itself. - */ - public PageOfDataControllerResource withValue(List value) { - this.value = value; - return this; - } - /** * Get the nextLink property: Link to retrieve next page of results. * @@ -63,28 +52,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: Link to retrieve next page of results. - * - * @param nextLink the nextLink value to set. - * @return the PageOfDataControllerResource object itself. - */ - public PageOfDataControllerResource withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PostgresInstanceListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PostgresInstanceListResult.java new file mode 100644 index 000000000000..6daee969614e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PostgresInstanceListResult.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of PostgresInstance. + */ +@Immutable +public final class PostgresInstanceListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of PostgresInstanceListResult class. + */ + private PostgresInstanceListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PostgresInstanceListResult. + */ + public static PostgresInstanceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceListResult deserializedPostgresInstanceListResult = new PostgresInstanceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PostgresInstanceInner.fromJson(reader1)); + deserializedPostgresInstanceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPostgresInstanceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlManagedInstanceListResult.java similarity index 87% rename from sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java rename to sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlManagedInstanceListResult.java index 5def4b68e6c8..79a24b72d580 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceListResult.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlManagedInstanceListResult.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.azurearcdata.models; +package com.azure.resourcemanager.azurearcdata.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class SqlManagedInstanceListResult implements JsonSerializable e.validate()); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerEsuLicenseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerEsuLicenseListResult.java new file mode 100644 index 000000000000..8308e1070c61 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerEsuLicenseListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of SQL Server ESU licenses. + */ +@Immutable +public final class SqlServerEsuLicenseListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerEsuLicenseListResult class. + */ + private SqlServerEsuLicenseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseListResult. + */ + public static SqlServerEsuLicenseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseListResult deserializedSqlServerEsuLicenseListResult + = new SqlServerEsuLicenseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerEsuLicenseInner.fromJson(reader1)); + deserializedSqlServerEsuLicenseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerEsuLicenseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceBpaResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceBpaResponse.java new file mode 100644 index 000000000000..1022799c4f1d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceBpaResponse.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaColumn; +import java.io.IOException; +import java.util.List; + +/** + * A section of the SQL best practices assessment response. + */ +@Immutable +public final class SqlServerInstanceBpaResponse implements JsonSerializable { + /* + * The SQL best practices assessment response columns. + */ + private List columns; + + /* + * An array of results of the SQL best practices assessment response. + */ + private List> rows; + + /* + * The link to the next page of the best practices assessment response for the SQL Server instance. Null, if no more + * pages are available. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerInstanceBpaResponse class. + */ + private SqlServerInstanceBpaResponse() { + } + + /** + * Get the columns property: The SQL best practices assessment response columns. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Get the rows property: An array of results of the SQL best practices assessment response. + * + * @return the rows value. + */ + public List> rows() { + return this.rows; + } + + /** + * Get the nextLink property: The link to the next page of the best practices assessment response for the SQL Server + * instance. Null, if no more pages are available. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("rows", this.rows, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceBpaResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceBpaResponse if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceBpaResponse. + */ + public static SqlServerInstanceBpaResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceBpaResponse deserializedSqlServerInstanceBpaResponse = new SqlServerInstanceBpaResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columns".equals(fieldName)) { + List columns + = reader.readArray(reader1 -> SqlServerInstanceBpaColumn.fromJson(reader1)); + deserializedSqlServerInstanceBpaResponse.columns = columns; + } else if ("rows".equals(fieldName)) { + List> rows + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedSqlServerInstanceBpaResponse.rows = rows; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerInstanceBpaResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceBpaResponse; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceListResult.java similarity index 87% rename from sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java rename to sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceListResult.java index d432729f38cc..6caca70e86ec 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceListResult.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceListResult.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.azurearcdata.models; +package com.azure.resourcemanager.azurearcdata.implementation.models; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; @@ -31,7 +31,7 @@ public final class SqlServerInstanceListResult implements JsonSerializable e.validate()); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceTelemetryResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceTelemetryResponse.java new file mode 100644 index 000000000000..015040786924 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceTelemetryResponse.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryColumn; +import java.io.IOException; +import java.util.List; + +/** + * A section of the telemetry response for the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceTelemetryResponse implements JsonSerializable { + /* + * The columns of the result telemetry table for the SQL Server instance. + */ + private List columns; + + /* + * A list of rows from the result telemetry table for the SQL Server instance. + */ + private List> rows; + + /* + * The link to the next section of rows of the telemetry response for the SQL Server instance. Null if no more + * sections are available. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerInstanceTelemetryResponse class. + */ + private SqlServerInstanceTelemetryResponse() { + } + + /** + * Get the columns property: The columns of the result telemetry table for the SQL Server instance. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Get the rows property: A list of rows from the result telemetry table for the SQL Server instance. + * + * @return the rows value. + */ + public List> rows() { + return this.rows; + } + + /** + * Get the nextLink property: The link to the next section of rows of the telemetry response for the SQL Server + * instance. Null if no more sections are available. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("columns", this.columns, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("rows", this.rows, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTelemetryResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTelemetryResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceTelemetryResponse. + */ + public static SqlServerInstanceTelemetryResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTelemetryResponse deserializedSqlServerInstanceTelemetryResponse + = new SqlServerInstanceTelemetryResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("columns".equals(fieldName)) { + List columns + = reader.readArray(reader1 -> SqlServerInstanceTelemetryColumn.fromJson(reader1)); + deserializedSqlServerInstanceTelemetryResponse.columns = columns; + } else if ("rows".equals(fieldName)) { + List> rows + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedSqlServerInstanceTelemetryResponse.rows = rows; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTelemetryResponse; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerLicenseListResult.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerLicenseListResult.java new file mode 100644 index 000000000000..59bbd95fda24 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerLicenseListResult.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of SQL Server licenses. + */ +@Immutable +public final class SqlServerLicenseListResult implements JsonSerializable { + /* + * Array of results. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerLicenseListResult class. + */ + private SqlServerLicenseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerLicenseListResult. + */ + public static SqlServerLicenseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseListResult deserializedSqlServerLicenseListResult = new SqlServerLicenseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlServerLicenseInner.fromJson(reader1)); + deserializedSqlServerLicenseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerLicenseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseListResult; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java index af3137d36b15..0b72cd14b6f5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for AzureArcDataManagementClient. + * Package containing the implementations for AzureArcData. * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc * Resources. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java new file mode 100644 index 000000000000..672795d4dbe3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The service account provisioning mode for this Active Directory connector. + */ +public final class AccountProvisioningMode extends ExpandableStringEnum { + /** + * automatic. + */ + public static final AccountProvisioningMode AUTOMATIC = fromString("automatic"); + + /** + * manual. + */ + public static final AccountProvisioningMode MANUAL = fromString("manual"); + + /** + * Creates a new instance of AccountProvisioningMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccountProvisioningMode() { + } + + /** + * Creates or finds a AccountProvisioningMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountProvisioningMode. + */ + public static AccountProvisioningMode fromString(String name) { + return fromString(name, AccountProvisioningMode.class); + } + + /** + * Gets known AccountProvisioningMode values. + * + * @return known AccountProvisioningMode values. + */ + public static Collection values() { + return values(AccountProvisioningMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.java new file mode 100644 index 000000000000..fff3769c2fd4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The activation state of the license. + */ +public final class ActivationState extends ExpandableStringEnum { + /** + * Activated. + */ + public static final ActivationState ACTIVATED = fromString("Activated"); + + /** + * Deactivated. + */ + public static final ActivationState DEACTIVATED = fromString("Deactivated"); + + /** + * Creates a new instance of ActivationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActivationState() { + } + + /** + * Creates or finds a ActivationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivationState. + */ + public static ActivationState fromString(String name) { + return fromString(name, ActivationState.class); + } + + /** + * Gets known ActivationState values. + * + * @return known ActivationState values. + */ + public static Collection values() { + return values(ActivationState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDNSDetails.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDNSDetails.java new file mode 100644 index 000000000000..2dc9818f052e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDNSDetails.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * DNS server details. + */ +@Fluent +public final class ActiveDirectoryConnectorDNSDetails implements JsonSerializable { + /* + * DNS domain name for which DNS lookups should be forwarded to the Active Directory DNS servers. + */ + private String domainName; + + /* + * List of Active Directory DNS server IP addresses. + */ + private List nameserverIPAddresses; + + /* + * Replica count for DNS proxy service. Default value is 1. + */ + private Long replicas; + + /* + * Flag indicating whether to prefer Kubernetes DNS server response over AD DNS server response for IP address + * lookups. + */ + private Boolean preferK8SDnsForPtrLookups; + + /** + * Creates an instance of ActiveDirectoryConnectorDNSDetails class. + */ + public ActiveDirectoryConnectorDNSDetails() { + } + + /** + * Get the domainName property: DNS domain name for which DNS lookups should be forwarded to the Active Directory + * DNS servers. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Set the domainName property: DNS domain name for which DNS lookups should be forwarded to the Active Directory + * DNS servers. + * + * @param domainName the domainName value to set. + * @return the ActiveDirectoryConnectorDNSDetails object itself. + */ + public ActiveDirectoryConnectorDNSDetails withDomainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Get the nameserverIPAddresses property: List of Active Directory DNS server IP addresses. + * + * @return the nameserverIPAddresses value. + */ + public List nameserverIPAddresses() { + return this.nameserverIPAddresses; + } + + /** + * Set the nameserverIPAddresses property: List of Active Directory DNS server IP addresses. + * + * @param nameserverIPAddresses the nameserverIPAddresses value to set. + * @return the ActiveDirectoryConnectorDNSDetails object itself. + */ + public ActiveDirectoryConnectorDNSDetails withNameserverIPAddresses(List nameserverIPAddresses) { + this.nameserverIPAddresses = nameserverIPAddresses; + return this; + } + + /** + * Get the replicas property: Replica count for DNS proxy service. Default value is 1. + * + * @return the replicas value. + */ + public Long replicas() { + return this.replicas; + } + + /** + * Set the replicas property: Replica count for DNS proxy service. Default value is 1. + * + * @param replicas the replicas value to set. + * @return the ActiveDirectoryConnectorDNSDetails object itself. + */ + public ActiveDirectoryConnectorDNSDetails withReplicas(Long replicas) { + this.replicas = replicas; + return this; + } + + /** + * Get the preferK8SDnsForPtrLookups property: Flag indicating whether to prefer Kubernetes DNS server response over + * AD DNS server response for IP address lookups. + * + * @return the preferK8SDnsForPtrLookups value. + */ + public Boolean preferK8SDnsForPtrLookups() { + return this.preferK8SDnsForPtrLookups; + } + + /** + * Set the preferK8SDnsForPtrLookups property: Flag indicating whether to prefer Kubernetes DNS server response over + * AD DNS server response for IP address lookups. + * + * @param preferK8SDnsForPtrLookups the preferK8SDnsForPtrLookups value to set. + * @return the ActiveDirectoryConnectorDNSDetails object itself. + */ + public ActiveDirectoryConnectorDNSDetails withPreferK8SDnsForPtrLookups(Boolean preferK8SDnsForPtrLookups) { + this.preferK8SDnsForPtrLookups = preferK8SDnsForPtrLookups; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("nameserverIPAddresses", this.nameserverIPAddresses, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("domainName", this.domainName); + jsonWriter.writeNumberField("replicas", this.replicas); + jsonWriter.writeBooleanField("preferK8sDnsForPtrLookups", this.preferK8SDnsForPtrLookups); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorDNSDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorDNSDetails if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorDNSDetails. + */ + public static ActiveDirectoryConnectorDNSDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorDNSDetails deserializedActiveDirectoryConnectorDNSDetails + = new ActiveDirectoryConnectorDNSDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameserverIPAddresses".equals(fieldName)) { + List nameserverIPAddresses = reader.readArray(reader1 -> reader1.getString()); + deserializedActiveDirectoryConnectorDNSDetails.nameserverIPAddresses = nameserverIPAddresses; + } else if ("domainName".equals(fieldName)) { + deserializedActiveDirectoryConnectorDNSDetails.domainName = reader.getString(); + } else if ("replicas".equals(fieldName)) { + deserializedActiveDirectoryConnectorDNSDetails.replicas = reader.getNullable(JsonReader::getLong); + } else if ("preferK8sDnsForPtrLookups".equals(fieldName)) { + deserializedActiveDirectoryConnectorDNSDetails.preferK8SDnsForPtrLookups + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorDNSDetails; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java new file mode 100644 index 000000000000..ad4afa698345 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Active Directory domain details. + */ +@Fluent +public final class ActiveDirectoryConnectorDomainDetails + implements JsonSerializable { + /* + * Name (uppercase) of the Active Directory domain that this AD connector will be associated with. + */ + private String realm; + + /* + * NETBIOS name of the Active Directory domain. + */ + private String netbiosDomainName; + + /* + * The service account provisioning mode for this Active Directory connector. + */ + private AccountProvisioningMode serviceAccountProvisioning; + + /* + * The distinguished name of the Active Directory Organizational Unit. + */ + private String ouDistinguishedName; + + /* + * null + */ + private ActiveDirectoryDomainControllers domainControllers; + + /** + * Creates an instance of ActiveDirectoryConnectorDomainDetails class. + */ + public ActiveDirectoryConnectorDomainDetails() { + } + + /** + * Get the realm property: Name (uppercase) of the Active Directory domain that this AD connector will be associated + * with. + * + * @return the realm value. + */ + public String realm() { + return this.realm; + } + + /** + * Set the realm property: Name (uppercase) of the Active Directory domain that this AD connector will be associated + * with. + * + * @param realm the realm value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails withRealm(String realm) { + this.realm = realm; + return this; + } + + /** + * Get the netbiosDomainName property: NETBIOS name of the Active Directory domain. + * + * @return the netbiosDomainName value. + */ + public String netbiosDomainName() { + return this.netbiosDomainName; + } + + /** + * Set the netbiosDomainName property: NETBIOS name of the Active Directory domain. + * + * @param netbiosDomainName the netbiosDomainName value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails withNetbiosDomainName(String netbiosDomainName) { + this.netbiosDomainName = netbiosDomainName; + return this; + } + + /** + * Get the serviceAccountProvisioning property: The service account provisioning mode for this Active Directory + * connector. + * + * @return the serviceAccountProvisioning value. + */ + public AccountProvisioningMode serviceAccountProvisioning() { + return this.serviceAccountProvisioning; + } + + /** + * Set the serviceAccountProvisioning property: The service account provisioning mode for this Active Directory + * connector. + * + * @param serviceAccountProvisioning the serviceAccountProvisioning value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails + withServiceAccountProvisioning(AccountProvisioningMode serviceAccountProvisioning) { + this.serviceAccountProvisioning = serviceAccountProvisioning; + return this; + } + + /** + * Get the ouDistinguishedName property: The distinguished name of the Active Directory Organizational Unit. + * + * @return the ouDistinguishedName value. + */ + public String ouDistinguishedName() { + return this.ouDistinguishedName; + } + + /** + * Set the ouDistinguishedName property: The distinguished name of the Active Directory Organizational Unit. + * + * @param ouDistinguishedName the ouDistinguishedName value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails withOuDistinguishedName(String ouDistinguishedName) { + this.ouDistinguishedName = ouDistinguishedName; + return this; + } + + /** + * Get the domainControllers property: null. + * + * @return the domainControllers value. + */ + public ActiveDirectoryDomainControllers domainControllers() { + return this.domainControllers; + } + + /** + * Set the domainControllers property: null. + * + * @param domainControllers the domainControllers value to set. + * @return the ActiveDirectoryConnectorDomainDetails object itself. + */ + public ActiveDirectoryConnectorDomainDetails + withDomainControllers(ActiveDirectoryDomainControllers domainControllers) { + this.domainControllers = domainControllers; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("realm", this.realm); + jsonWriter.writeStringField("netbiosDomainName", this.netbiosDomainName); + jsonWriter.writeStringField("serviceAccountProvisioning", + this.serviceAccountProvisioning == null ? null : this.serviceAccountProvisioning.toString()); + jsonWriter.writeStringField("ouDistinguishedName", this.ouDistinguishedName); + jsonWriter.writeJsonField("domainControllers", this.domainControllers); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorDomainDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorDomainDetails if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorDomainDetails. + */ + public static ActiveDirectoryConnectorDomainDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorDomainDetails deserializedActiveDirectoryConnectorDomainDetails + = new ActiveDirectoryConnectorDomainDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("realm".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.realm = reader.getString(); + } else if ("netbiosDomainName".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.netbiosDomainName = reader.getString(); + } else if ("serviceAccountProvisioning".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.serviceAccountProvisioning + = AccountProvisioningMode.fromString(reader.getString()); + } else if ("ouDistinguishedName".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.ouDistinguishedName = reader.getString(); + } else if ("domainControllers".equals(fieldName)) { + deserializedActiveDirectoryConnectorDomainDetails.domainControllers + = ActiveDirectoryDomainControllers.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorDomainDetails; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java new file mode 100644 index 000000000000..0a41295e84e0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of an Active Directory connector resource. + */ +@Fluent +public final class ActiveDirectoryConnectorProperties implements JsonSerializable { + /* + * Username and password for domain service account authentication. + */ + private BasicLoginInformation domainServiceAccountLoginInformation; + + /* + * The provisioning state of the Active Directory connector resource. + */ + private String provisioningState; + + /* + * null + */ + private ActiveDirectoryConnectorSpec spec; + + /* + * null + */ + private ActiveDirectoryConnectorStatus status; + + /** + * Creates an instance of ActiveDirectoryConnectorProperties class. + */ + public ActiveDirectoryConnectorProperties() { + } + + /** + * Get the domainServiceAccountLoginInformation property: Username and password for domain service account + * authentication. + * + * @return the domainServiceAccountLoginInformation value. + */ + public BasicLoginInformation domainServiceAccountLoginInformation() { + return this.domainServiceAccountLoginInformation; + } + + /** + * Set the domainServiceAccountLoginInformation property: Username and password for domain service account + * authentication. + * + * @param domainServiceAccountLoginInformation the domainServiceAccountLoginInformation value to set. + * @return the ActiveDirectoryConnectorProperties object itself. + */ + public ActiveDirectoryConnectorProperties + withDomainServiceAccountLoginInformation(BasicLoginInformation domainServiceAccountLoginInformation) { + this.domainServiceAccountLoginInformation = domainServiceAccountLoginInformation; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Active Directory connector resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the spec property: null. + * + * @return the spec value. + */ + public ActiveDirectoryConnectorSpec spec() { + return this.spec; + } + + /** + * Set the spec property: null. + * + * @param spec the spec value to set. + * @return the ActiveDirectoryConnectorProperties object itself. + */ + public ActiveDirectoryConnectorProperties withSpec(ActiveDirectoryConnectorSpec spec) { + this.spec = spec; + return this; + } + + /** + * Get the status property: null. + * + * @return the status value. + */ + public ActiveDirectoryConnectorStatus status() { + return this.status; + } + + /** + * Set the status property: null. + * + * @param status the status value to set. + * @return the ActiveDirectoryConnectorProperties object itself. + */ + public ActiveDirectoryConnectorProperties withStatus(ActiveDirectoryConnectorStatus status) { + this.status = status; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("spec", this.spec); + jsonWriter.writeJsonField("domainServiceAccountLoginInformation", this.domainServiceAccountLoginInformation); + jsonWriter.writeJsonField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorProperties. + */ + public static ActiveDirectoryConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorProperties deserializedActiveDirectoryConnectorProperties + = new ActiveDirectoryConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("spec".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.spec = ActiveDirectoryConnectorSpec.fromJson(reader); + } else if ("domainServiceAccountLoginInformation".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.domainServiceAccountLoginInformation + = BasicLoginInformation.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.provisioningState = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedActiveDirectoryConnectorProperties.status + = ActiveDirectoryConnectorStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java new file mode 100644 index 000000000000..7fb00c44db72 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner; + +/** + * An immutable client-side representation of ActiveDirectoryConnectorResource. + */ +public interface ActiveDirectoryConnectorResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + ActiveDirectoryConnectorProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner object. + * + * @return the inner object. + */ + ActiveDirectoryConnectorResourceInner innerModel(); + + /** + * The entirety of the ActiveDirectoryConnectorResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The ActiveDirectoryConnectorResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ActiveDirectoryConnectorResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ActiveDirectoryConnectorResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, dataControllerName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @return the next definition stage. + */ + WithProperties withExistingDataController(String resourceGroupName, String dataControllerName); + } + + /** + * The stage of the ActiveDirectoryConnectorResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(ActiveDirectoryConnectorProperties properties); + } + + /** + * The stage of the ActiveDirectoryConnectorResource definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + ActiveDirectoryConnectorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ActiveDirectoryConnectorResource create(Context context); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ActiveDirectoryConnectorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ActiveDirectoryConnectorResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java new file mode 100644 index 000000000000..dea3fb2ef532 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The specifications of the AD Kubernetes resource. + */ +@Fluent +public final class ActiveDirectoryConnectorSpec implements JsonSerializable { + /* + * null + */ + private ActiveDirectoryConnectorDomainDetails activeDirectory; + + /* + * null + */ + private ActiveDirectoryConnectorDNSDetails dns; + + /** + * Creates an instance of ActiveDirectoryConnectorSpec class. + */ + public ActiveDirectoryConnectorSpec() { + } + + /** + * Get the activeDirectory property: null. + * + * @return the activeDirectory value. + */ + public ActiveDirectoryConnectorDomainDetails activeDirectory() { + return this.activeDirectory; + } + + /** + * Set the activeDirectory property: null. + * + * @param activeDirectory the activeDirectory value to set. + * @return the ActiveDirectoryConnectorSpec object itself. + */ + public ActiveDirectoryConnectorSpec withActiveDirectory(ActiveDirectoryConnectorDomainDetails activeDirectory) { + this.activeDirectory = activeDirectory; + return this; + } + + /** + * Get the dns property: null. + * + * @return the dns value. + */ + public ActiveDirectoryConnectorDNSDetails dns() { + return this.dns; + } + + /** + * Set the dns property: null. + * + * @param dns the dns value to set. + * @return the ActiveDirectoryConnectorSpec object itself. + */ + public ActiveDirectoryConnectorSpec withDns(ActiveDirectoryConnectorDNSDetails dns) { + this.dns = dns; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("activeDirectory", this.activeDirectory); + jsonWriter.writeJsonField("dns", this.dns); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorSpec if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorSpec. + */ + public static ActiveDirectoryConnectorSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorSpec deserializedActiveDirectoryConnectorSpec = new ActiveDirectoryConnectorSpec(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("activeDirectory".equals(fieldName)) { + deserializedActiveDirectoryConnectorSpec.activeDirectory + = ActiveDirectoryConnectorDomainDetails.fromJson(reader); + } else if ("dns".equals(fieldName)) { + deserializedActiveDirectoryConnectorSpec.dns = ActiveDirectoryConnectorDNSDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryConnectorSpec; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java new file mode 100644 index 000000000000..e3c6dd04cb4a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The status of the Kubernetes custom resource. + */ +@Fluent +public final class ActiveDirectoryConnectorStatus implements JsonSerializable { + /* + * The time that the custom resource was last updated. + */ + private String lastUpdateTime; + + /* + * The version of the replicaSet associated with the AD connector custom resource. + */ + private Long observedGeneration; + + /* + * The state of the AD connector custom resource. + */ + private String state; + + /* + * The status of the Kubernetes custom resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of ActiveDirectoryConnectorStatus class. + */ + public ActiveDirectoryConnectorStatus() { + } + + /** + * Get the lastUpdateTime property: The time that the custom resource was last updated. + * + * @return the lastUpdateTime value. + */ + public String lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime property: The time that the custom resource was last updated. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withLastUpdateTime(String lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the observedGeneration property: The version of the replicaSet associated with the AD connector custom + * resource. + * + * @return the observedGeneration value. + */ + public Long observedGeneration() { + return this.observedGeneration; + } + + /** + * Set the observedGeneration property: The version of the replicaSet associated with the AD connector custom + * resource. + * + * @param observedGeneration the observedGeneration value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withObservedGeneration(Long observedGeneration) { + this.observedGeneration = observedGeneration; + return this; + } + + /** + * Get the state property: The state of the AD connector custom resource. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state of the AD connector custom resource. + * + * @param state the state value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withState(String state) { + this.state = state; + return this; + } + + /** + * Get the additionalProperties property: The status of the Kubernetes custom resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The status of the Kubernetes custom resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ActiveDirectoryConnectorStatus object itself. + */ + public ActiveDirectoryConnectorStatus withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastUpdateTime", this.lastUpdateTime); + jsonWriter.writeNumberField("observedGeneration", this.observedGeneration); + jsonWriter.writeStringField("state", this.state); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryConnectorStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryConnectorStatus if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryConnectorStatus. + */ + public static ActiveDirectoryConnectorStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryConnectorStatus deserializedActiveDirectoryConnectorStatus + = new ActiveDirectoryConnectorStatus(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastUpdateTime".equals(fieldName)) { + deserializedActiveDirectoryConnectorStatus.lastUpdateTime = reader.getString(); + } else if ("observedGeneration".equals(fieldName)) { + deserializedActiveDirectoryConnectorStatus.observedGeneration + = reader.getNullable(JsonReader::getLong); + } else if ("state".equals(fieldName)) { + deserializedActiveDirectoryConnectorStatus.state = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedActiveDirectoryConnectorStatus.additionalProperties = additionalProperties; + + return deserializedActiveDirectoryConnectorStatus; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java new file mode 100644 index 000000000000..a938da1f2bfa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ActiveDirectoryConnectors. + */ +public interface ActiveDirectoryConnectors { + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName, Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource. + */ + ActiveDirectoryConnectorResource get(String resourceGroupName, String dataControllerName, + String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName); + + /** + * Deletes an Active Directory connector resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param activeDirectoryConnectorName The name of the Active Directory connector instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String dataControllerName, String activeDirectoryConnectorName, + Context context); + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String dataControllerName); + + /** + * List the active directory connectors associated with the given data controller. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory connectors as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String dataControllerName, + Context context); + + /** + * Retrieves an Active Directory connector resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + ActiveDirectoryConnectorResource getById(String id); + + /** + * Retrieves an Active Directory connector resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return active directory connector resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Active Directory connector resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Active Directory connector resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ActiveDirectoryConnectorResource resource. + * + * @param name resource name. + * @return the first stage of the new ActiveDirectoryConnectorResource definition. + */ + ActiveDirectoryConnectorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java new file mode 100644 index 000000000000..5bd8f0640cad --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Information about a domain controller in the AD domain. + */ +@Fluent +public final class ActiveDirectoryDomainController implements JsonSerializable { + /* + * Fully-qualified domain name of a domain controller in the AD domain. + */ + private String hostname; + + /** + * Creates an instance of ActiveDirectoryDomainController class. + */ + public ActiveDirectoryDomainController() { + } + + /** + * Get the hostname property: Fully-qualified domain name of a domain controller in the AD domain. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Set the hostname property: Fully-qualified domain name of a domain controller in the AD domain. + * + * @param hostname the hostname value to set. + * @return the ActiveDirectoryDomainController object itself. + */ + public ActiveDirectoryDomainController withHostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("hostname", this.hostname); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryDomainController from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryDomainController if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveDirectoryDomainController. + */ + public static ActiveDirectoryDomainController fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryDomainController deserializedActiveDirectoryDomainController + = new ActiveDirectoryDomainController(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hostname".equals(fieldName)) { + deserializedActiveDirectoryDomainController.hostname = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryDomainController; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java new file mode 100644 index 000000000000..094933e97072 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Details about the Active Directory domain controllers associated with this AD connector instance. + */ +@Fluent +public final class ActiveDirectoryDomainControllers implements JsonSerializable { + /* + * Information about the Primary Domain Controller (PDC) in the AD domain. + */ + private ActiveDirectoryDomainController primaryDomainController; + + /* + * null + */ + private List secondaryDomainControllers; + + /** + * Creates an instance of ActiveDirectoryDomainControllers class. + */ + public ActiveDirectoryDomainControllers() { + } + + /** + * Get the primaryDomainController property: Information about the Primary Domain Controller (PDC) in the AD domain. + * + * @return the primaryDomainController value. + */ + public ActiveDirectoryDomainController primaryDomainController() { + return this.primaryDomainController; + } + + /** + * Set the primaryDomainController property: Information about the Primary Domain Controller (PDC) in the AD domain. + * + * @param primaryDomainController the primaryDomainController value to set. + * @return the ActiveDirectoryDomainControllers object itself. + */ + public ActiveDirectoryDomainControllers + withPrimaryDomainController(ActiveDirectoryDomainController primaryDomainController) { + this.primaryDomainController = primaryDomainController; + return this; + } + + /** + * Get the secondaryDomainControllers property: null. + * + * @return the secondaryDomainControllers value. + */ + public List secondaryDomainControllers() { + return this.secondaryDomainControllers; + } + + /** + * Set the secondaryDomainControllers property: null. + * + * @param secondaryDomainControllers the secondaryDomainControllers value to set. + * @return the ActiveDirectoryDomainControllers object itself. + */ + public ActiveDirectoryDomainControllers + withSecondaryDomainControllers(List secondaryDomainControllers) { + this.secondaryDomainControllers = secondaryDomainControllers; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("primaryDomainController", this.primaryDomainController); + jsonWriter.writeArrayField("secondaryDomainControllers", this.secondaryDomainControllers, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryDomainControllers from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryDomainControllers if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryDomainControllers. + */ + public static ActiveDirectoryDomainControllers fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryDomainControllers deserializedActiveDirectoryDomainControllers + = new ActiveDirectoryDomainControllers(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryDomainController".equals(fieldName)) { + deserializedActiveDirectoryDomainControllers.primaryDomainController + = ActiveDirectoryDomainController.fromJson(reader); + } else if ("secondaryDomainControllers".equals(fieldName)) { + List secondaryDomainControllers + = reader.readArray(reader1 -> ActiveDirectoryDomainController.fromJson(reader1)); + deserializedActiveDirectoryDomainControllers.secondaryDomainControllers + = secondaryDomainControllers; + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryDomainControllers; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java new file mode 100644 index 000000000000..954839e0681c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Active Directory information that related to the resource. + */ +@Fluent +public final class ActiveDirectoryInformation implements JsonSerializable { + /* + * Keytab information that is used for the Sql Managed Instance when Active Directory authentication is used. + */ + private KeytabInformation keytabInformation; + + /** + * Creates an instance of ActiveDirectoryInformation class. + */ + public ActiveDirectoryInformation() { + } + + /** + * Get the keytabInformation property: Keytab information that is used for the Sql Managed Instance when Active + * Directory authentication is used. + * + * @return the keytabInformation value. + */ + public KeytabInformation keytabInformation() { + return this.keytabInformation; + } + + /** + * Set the keytabInformation property: Keytab information that is used for the Sql Managed Instance when Active + * Directory authentication is used. + * + * @param keytabInformation the keytabInformation value to set. + * @return the ActiveDirectoryInformation object itself. + */ + public ActiveDirectoryInformation withKeytabInformation(KeytabInformation keytabInformation) { + this.keytabInformation = keytabInformation; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("keytabInformation", this.keytabInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveDirectoryInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveDirectoryInformation if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActiveDirectoryInformation. + */ + public static ActiveDirectoryInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveDirectoryInformation deserializedActiveDirectoryInformation = new ActiveDirectoryInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keytabInformation".equals(fieldName)) { + deserializedActiveDirectoryInformation.keytabInformation = KeytabInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveDirectoryInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AdditionalMigrationJobAttributes.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AdditionalMigrationJobAttributes.java new file mode 100644 index 000000000000..fef046a8ab6e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AdditionalMigrationJobAttributes.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Any other migration type specific attributes to associate with this job. + */ +@Fluent +public final class AdditionalMigrationJobAttributes implements JsonSerializable { + /* + * Unique attribute name. + */ + private String keyName; + + /* + * Attribute value. + */ + private String keyValue; + + /** + * Creates an instance of AdditionalMigrationJobAttributes class. + */ + public AdditionalMigrationJobAttributes() { + } + + /** + * Get the keyName property: Unique attribute name. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Unique attribute name. + * + * @param keyName the keyName value to set. + * @return the AdditionalMigrationJobAttributes object itself. + */ + public AdditionalMigrationJobAttributes withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyValue property: Attribute value. + * + * @return the keyValue value. + */ + public String keyValue() { + return this.keyValue; + } + + /** + * Set the keyValue property: Attribute value. + * + * @param keyValue the keyValue value to set. + * @return the AdditionalMigrationJobAttributes object itself. + */ + public AdditionalMigrationJobAttributes withKeyValue(String keyValue) { + this.keyValue = keyValue; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyName", this.keyName); + jsonWriter.writeStringField("keyValue", this.keyValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdditionalMigrationJobAttributes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdditionalMigrationJobAttributes if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AdditionalMigrationJobAttributes. + */ + public static AdditionalMigrationJobAttributes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdditionalMigrationJobAttributes deserializedAdditionalMigrationJobAttributes + = new AdditionalMigrationJobAttributes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyName".equals(fieldName)) { + deserializedAdditionalMigrationJobAttributes.keyName = reader.getString(); + } else if ("keyValue".equals(fieldName)) { + deserializedAdditionalMigrationJobAttributes.keyValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAdditionalMigrationJobAttributes; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java new file mode 100644 index 000000000000..83fe2226dd53 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The aggregation type to use for the numerical columns in the dataset. + */ +public final class AggregationType extends ExpandableStringEnum { + /** + * Average. + */ + public static final AggregationType AVERAGE = fromString("Average"); + + /** + * Minimum. + */ + public static final AggregationType MINIMUM = fromString("Minimum"); + + /** + * Maximum. + */ + public static final AggregationType MAXIMUM = fromString("Maximum"); + + /** + * Sum. + */ + public static final AggregationType SUM = fromString("Sum"); + + /** + * Count. + */ + public static final AggregationType COUNT = fromString("Count"); + + /** + * Creates a new instance of AggregationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AggregationType() { + } + + /** + * Creates or finds a AggregationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregationType. + */ + public static AggregationType fromString(String name) { + return fromString(name, AggregationType.class); + } + + /** + * Gets known AggregationType values. + * + * @return known AggregationType values. + */ + public static Collection values() { + return values(AggregationType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java new file mode 100644 index 000000000000..545ac8f77033 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The role of the SQL Server, based on availability. + */ +public final class AlwaysOnRole extends ExpandableStringEnum { + /** + * None. + */ + public static final AlwaysOnRole NONE = fromString("None"); + + /** + * FailoverClusterInstance. + */ + public static final AlwaysOnRole FAILOVER_CLUSTER_INSTANCE = fromString("FailoverClusterInstance"); + + /** + * FailoverClusterNode. + */ + public static final AlwaysOnRole FAILOVER_CLUSTER_NODE = fromString("FailoverClusterNode"); + + /** + * AvailabilityGroupReplica. + */ + public static final AlwaysOnRole AVAILABILITY_GROUP_REPLICA = fromString("AvailabilityGroupReplica"); + + /** + * Creates a new instance of AlwaysOnRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AlwaysOnRole() { + } + + /** + * Creates or finds a AlwaysOnRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlwaysOnRole. + */ + public static AlwaysOnRole fromString(String name) { + return fromString(name, AlwaysOnRole.class); + } + + /** + * Gets known AlwaysOnRole values. + * + * @return known AlwaysOnRole values. + */ + public static Collection values() { + return values(AlwaysOnRole.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java index 27f77b131f9b..867109e7bf4c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java @@ -1,56 +1,56 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + /** * The license type to apply for this managed instance. */ -public enum ArcSqlManagedInstanceLicenseType { +public final class ArcSqlManagedInstanceLicenseType extends ExpandableStringEnum { /** - * Enum value BasePrice. + * BasePrice. */ - BASE_PRICE("BasePrice"), + public static final ArcSqlManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); /** - * Enum value LicenseIncluded. + * LicenseIncluded. */ - LICENSE_INCLUDED("LicenseIncluded"); + public static final ArcSqlManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); /** - * The actual serialized value for a ArcSqlManagedInstanceLicenseType instance. + * DisasterRecovery. */ - private final String value; + public static final ArcSqlManagedInstanceLicenseType DISASTER_RECOVERY = fromString("DisasterRecovery"); - ArcSqlManagedInstanceLicenseType(String value) { - this.value = value; + /** + * Creates a new instance of ArcSqlManagedInstanceLicenseType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlManagedInstanceLicenseType() { } /** - * Parses a serialized value to a ArcSqlManagedInstanceLicenseType instance. + * Creates or finds a ArcSqlManagedInstanceLicenseType from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ArcSqlManagedInstanceLicenseType object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ArcSqlManagedInstanceLicenseType. */ - public static ArcSqlManagedInstanceLicenseType fromString(String value) { - if (value == null) { - return null; - } - ArcSqlManagedInstanceLicenseType[] items = ArcSqlManagedInstanceLicenseType.values(); - for (ArcSqlManagedInstanceLicenseType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ArcSqlManagedInstanceLicenseType fromString(String name) { + return fromString(name, ArcSqlManagedInstanceLicenseType.class); } /** - * {@inheritDoc} + * Gets known ArcSqlManagedInstanceLicenseType values. + * + * @return known ArcSqlManagedInstanceLicenseType values. */ - @Override - public String toString() { - return this.value; + public static Collection values() { + return values(ArcSqlManagedInstanceLicenseType.class); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupTypeFilter.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupTypeFilter.java new file mode 100644 index 000000000000..291878bad3b6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupTypeFilter.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Filter retrieval based on availability group type. + */ +public final class ArcSqlServerAvailabilityGroupTypeFilter + extends ExpandableStringEnum { + /** + * Contained Availability Group (CAG). + */ + public static final ArcSqlServerAvailabilityGroupTypeFilter CONTAINED = fromString("CONTAINED"); + + /** + * Distributed Availability Group (DAG). + */ + public static final ArcSqlServerAvailabilityGroupTypeFilter DISTRIBUTED = fromString("DISTRIBUTED"); + + /** + * Default standard availability group that is not contained or distributed. + */ + public static final ArcSqlServerAvailabilityGroupTypeFilter DEFAULT = fromString("DEFAULT"); + + /** + * Creates a new instance of ArcSqlServerAvailabilityGroupTypeFilter value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlServerAvailabilityGroupTypeFilter() { + } + + /** + * Creates or finds a ArcSqlServerAvailabilityGroupTypeFilter from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArcSqlServerAvailabilityGroupTypeFilter. + */ + public static ArcSqlServerAvailabilityGroupTypeFilter fromString(String name) { + return fromString(name, ArcSqlServerAvailabilityGroupTypeFilter.class); + } + + /** + * Gets known ArcSqlServerAvailabilityGroupTypeFilter values. + * + * @return known ArcSqlServerAvailabilityGroupTypeFilter values. + */ + public static Collection values() { + return values(ArcSqlServerAvailabilityGroupTypeFilter.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.java new file mode 100644 index 000000000000..3502a80fd616 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Property that determines whether a given availability replica can run in synchronous-commit mode. + */ +public final class ArcSqlServerAvailabilityMode extends ExpandableStringEnum { + /** + * SYNCHRONOUS_COMMIT. + */ + public static final ArcSqlServerAvailabilityMode SYNCHRONOUS_COMMIT = fromString("SYNCHRONOUS_COMMIT"); + + /** + * ASYNCHRONOUS_COMMIT. + */ + public static final ArcSqlServerAvailabilityMode ASYNCHRONOUS_COMMIT = fromString("ASYNCHRONOUS_COMMIT"); + + /** + * Creates a new instance of ArcSqlServerAvailabilityMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlServerAvailabilityMode() { + } + + /** + * Creates or finds a ArcSqlServerAvailabilityMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArcSqlServerAvailabilityMode. + */ + public static ArcSqlServerAvailabilityMode fromString(String name) { + return fromString(name, ArcSqlServerAvailabilityMode.class); + } + + /** + * Gets known ArcSqlServerAvailabilityMode values. + * + * @return known ArcSqlServerAvailabilityMode values. + */ + public static Collection values() { + return values(ArcSqlServerAvailabilityMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java new file mode 100644 index 000000000000..344fc9b7846d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Property to set the failover mode of the availability group replica. + */ +public final class ArcSqlServerFailoverMode extends ExpandableStringEnum { + /** + * AUTOMATIC. + */ + public static final ArcSqlServerFailoverMode AUTOMATIC = fromString("AUTOMATIC"); + + /** + * MANUAL. + */ + public static final ArcSqlServerFailoverMode MANUAL = fromString("MANUAL"); + + /** + * EXTERNAL. + */ + public static final ArcSqlServerFailoverMode EXTERNAL = fromString("EXTERNAL"); + + /** + * NONE. + */ + public static final ArcSqlServerFailoverMode NONE = fromString("NONE"); + + /** + * Creates a new instance of ArcSqlServerFailoverMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArcSqlServerFailoverMode() { + } + + /** + * Creates or finds a ArcSqlServerFailoverMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArcSqlServerFailoverMode. + */ + public static ArcSqlServerFailoverMode fromString(String name) { + return fromString(name, ArcSqlServerFailoverMode.class); + } + + /** + * Gets known ArcSqlServerFailoverMode values. + * + * @return known ArcSqlServerFailoverMode values. + */ + public static Collection values() { + return values(ArcSqlServerFailoverMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java index 8714e5852f9d..edace4a7d365 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -12,24 +12,44 @@ */ public final class ArcSqlServerLicenseType extends ExpandableStringEnum { /** - * Static value Paid for ArcSqlServerLicenseType. + * Undefined. */ - public static final ArcSqlServerLicenseType PAID = fromString("Paid"); + public static final ArcSqlServerLicenseType UNDEFINED = fromString("Undefined"); /** - * Static value Free for ArcSqlServerLicenseType. + * Free. */ public static final ArcSqlServerLicenseType FREE = fromString("Free"); /** - * Static value HADR for ArcSqlServerLicenseType. + * HADR. */ public static final ArcSqlServerLicenseType HADR = fromString("HADR"); /** - * Static value Undefined for ArcSqlServerLicenseType. + * ServerCAL. */ - public static final ArcSqlServerLicenseType UNDEFINED = fromString("Undefined"); + public static final ArcSqlServerLicenseType SERVER_CAL = fromString("ServerCAL"); + + /** + * LicenseOnly. + */ + public static final ArcSqlServerLicenseType LICENSE_ONLY = fromString("LicenseOnly"); + + /** + * PAYG. + */ + public static final ArcSqlServerLicenseType PAYG = fromString("PAYG"); + + /** + * Paid. + */ + public static final ArcSqlServerLicenseType PAID = fromString("Paid"); + + /** + * FabricCapacity. + */ + public static final ArcSqlServerLicenseType FABRIC_CAPACITY = fromString("FabricCapacity"); /** * Creates a new instance of ArcSqlServerLicenseType value. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AssessmentStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AssessmentStatus.java new file mode 100644 index 000000000000..62f30c38bd2c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AssessmentStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the requirement. + */ +public final class AssessmentStatus extends ExpandableStringEnum { + /** + * Success. + */ + public static final AssessmentStatus SUCCESS = fromString("Success"); + + /** + * Warning. + */ + public static final AssessmentStatus WARNING = fromString("Warning"); + + /** + * Failure. + */ + public static final AssessmentStatus FAILURE = fromString("Failure"); + + /** + * Creates a new instance of AssessmentStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AssessmentStatus() { + } + + /** + * Creates or finds a AssessmentStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssessmentStatus. + */ + public static AssessmentStatus fromString(String name) { + return fromString(name, AssessmentStatus.class); + } + + /** + * Gets known AssessmentStatus values. + * + * @return known AssessmentStatus values. + */ + public static Collection values() { + return values(AssessmentStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Authentication.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Authentication.java new file mode 100644 index 000000000000..fa69b36252bf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Authentication.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Authentication related configuration for the SQL Server Instance. + */ +@Fluent +public final class Authentication implements JsonSerializable { + /* + * Mode of authentication in SqlServer. + */ + private Mode mode; + + /* + * Entra Authentication configuration for the SQL Server Instance. + */ + private List sqlServerEntraIdentity; + + /** + * Creates an instance of Authentication class. + */ + public Authentication() { + } + + /** + * Get the mode property: Mode of authentication in SqlServer. + * + * @return the mode value. + */ + public Mode mode() { + return this.mode; + } + + /** + * Set the mode property: Mode of authentication in SqlServer. + * + * @param mode the mode value to set. + * @return the Authentication object itself. + */ + public Authentication withMode(Mode mode) { + this.mode = mode; + return this; + } + + /** + * Get the sqlServerEntraIdentity property: Entra Authentication configuration for the SQL Server Instance. + * + * @return the sqlServerEntraIdentity value. + */ + public List sqlServerEntraIdentity() { + return this.sqlServerEntraIdentity; + } + + /** + * Set the sqlServerEntraIdentity property: Entra Authentication configuration for the SQL Server Instance. + * + * @param sqlServerEntraIdentity the sqlServerEntraIdentity value to set. + * @return the Authentication object itself. + */ + public Authentication withSqlServerEntraIdentity(List sqlServerEntraIdentity) { + this.sqlServerEntraIdentity = sqlServerEntraIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + jsonWriter.writeArrayField("sqlServerEntraIdentity", this.sqlServerEntraIdentity, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Authentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Authentication if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Authentication. + */ + public static Authentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Authentication deserializedAuthentication = new Authentication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedAuthentication.mode = Mode.fromString(reader.getString()); + } else if ("sqlServerEntraIdentity".equals(fieldName)) { + List sqlServerEntraIdentity + = reader.readArray(reader1 -> EntraAuthentication.fromJson(reader1)); + deserializedAuthentication.sqlServerEntraIdentity = sqlServerEntraIdentity; + } else { + reader.skipChildren(); + } + } + + return deserializedAuthentication; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java new file mode 100644 index 000000000000..6e7e6936e20e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Preferred replica for running automated backups. + */ +public enum AutomatedBackupPreference { + /** + * PRIMARY. + */ + PRIMARY("PRIMARY"), + + /** + * SECONDARY_ONLY. + */ + SECONDARY_ONLY("SECONDARY_ONLY"), + + /** + * SECONDARY. + */ + SECONDARY("SECONDARY"), + + /** + * NONE. + */ + NONE("NONE"); + + /** + * The actual serialized value for a AutomatedBackupPreference instance. + */ + private final String value; + + AutomatedBackupPreference(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutomatedBackupPreference instance. + * + * @param value the serialized value to parse. + * @return the parsed AutomatedBackupPreference object, or null if unable to parse. + */ + public static AutomatedBackupPreference fromString(String value) { + if (value == null) { + return null; + } + AutomatedBackupPreference[] items = AutomatedBackupPreference.values(); + for (AutomatedBackupPreference item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java new file mode 100644 index 000000000000..a2d1bd189e91 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The specifications of the availability group replica configuration. + */ +@Fluent +public final class AvailabilityGroupConfigure implements JsonSerializable { + /* + * Name of the mirroring endpoint URL + */ + private String endpointName; + + /* + * Mirroring endpoint URL of availability group replica + */ + private String endpointUrl; + + /* + * Permitted authentication modes for the mirroring endpoint. + */ + private ConnectionAuth endpointAuthenticationMode; + + /* + * Name of certificate to use for authentication. Required if any CERTIFICATE authentication modes are specified. + */ + private String certificateName; + + /* + * The login which will connect to the mirroring endpoint. + */ + private String endpointConnectLogin; + + /* + * Property that determines whether a given availability replica can run in synchronous-commit mode + */ + private ArcSqlServerAvailabilityMode availabilityMode; + + /* + * The Availability Synchronization mode of the availability group replica. + */ + private String availabilityModeDescription; + + /* + * Property to set the failover mode of the availability group replica + */ + private ArcSqlServerFailoverMode failoverMode; + + /* + * The failover mode of the availability group replica. + */ + private String failoverModeDescription; + + /* + * The time-out period of availability group session replica, in seconds. + */ + private Integer sessionTimeout; + + /* + * Whether the primary replica should allow all connections or only READ_WRITE connections (disallowing ReadOnly + * connections) + */ + private PrimaryAllowConnections primaryAllowConnections; + + /* + * Whether the availability allows all connections or only read-write connections. + */ + private String primaryRoleAllowConnectionsDescription; + + /* + * Whether the secondary replica should allow all connections, no connections, or only ReadOnly connections. + */ + private SecondaryAllowConnections secondaryAllowConnections; + + /* + * Whether an availability replica that is performing the secondary role (that is, a secondary replica) can accept + * connections from clients. + */ + private String secondaryRoleAllowConnectionsDescription; + + /* + * Date that the replica was created. + */ + private OffsetDateTime replicaCreateDate; + + /* + * Date that the replica was modified. + */ + private OffsetDateTime replicaModifyDate; + + /* + * Represents the user-specified priority for performing backups on this replica relative to the other replicas in + * the same availability group. + */ + private Integer backupPriority; + + /* + * Connectivity endpoint (URL) of the read only availability replica. + */ + private String readOnlyRoutingUrl; + + /* + * Connectivity endpoint (URL) of the read write availability replica. + */ + private String readWriteRoutingUrl; + + /* + * Specifies how the secondary replica will be initially seeded. AUTOMATIC enables direct seeding. This method will + * seed the secondary replica over the network. This method does not require you to backup and restore a copy of the + * primary database on the replica. MANUAL specifies manual seeding (default). This method requires you to create a + * backup of the database on the primary replica and manually restore that backup on the secondary replica. + */ + private SeedingMode seedingMode; + + /* + * Describes seeding mode. + */ + private String seedingModeDescription; + + /** + * Creates an instance of AvailabilityGroupConfigure class. + */ + public AvailabilityGroupConfigure() { + } + + /** + * Get the endpointName property: Name of the mirroring endpoint URL. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Set the endpointName property: Name of the mirroring endpoint URL. + * + * @param endpointName the endpointName value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointName(String endpointName) { + this.endpointName = endpointName; + return this; + } + + /** + * Get the endpointUrl property: Mirroring endpoint URL of availability group replica. + * + * @return the endpointUrl value. + */ + public String endpointUrl() { + return this.endpointUrl; + } + + /** + * Set the endpointUrl property: Mirroring endpoint URL of availability group replica. + * + * @param endpointUrl the endpointUrl value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointUrl(String endpointUrl) { + this.endpointUrl = endpointUrl; + return this; + } + + /** + * Get the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @return the endpointAuthenticationMode value. + */ + public ConnectionAuth endpointAuthenticationMode() { + return this.endpointAuthenticationMode; + } + + /** + * Set the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @param endpointAuthenticationMode the endpointAuthenticationMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointAuthenticationMode(ConnectionAuth endpointAuthenticationMode) { + this.endpointAuthenticationMode = endpointAuthenticationMode; + return this; + } + + /** + * Get the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Set the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @param certificateName the certificateName value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withCertificateName(String certificateName) { + this.certificateName = certificateName; + return this; + } + + /** + * Get the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @return the endpointConnectLogin value. + */ + public String endpointConnectLogin() { + return this.endpointConnectLogin; + } + + /** + * Set the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @param endpointConnectLogin the endpointConnectLogin value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withEndpointConnectLogin(String endpointConnectLogin) { + this.endpointConnectLogin = endpointConnectLogin; + return this; + } + + /** + * Get the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @return the availabilityMode value. + */ + public ArcSqlServerAvailabilityMode availabilityMode() { + return this.availabilityMode; + } + + /** + * Set the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @param availabilityMode the availabilityMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withAvailabilityMode(ArcSqlServerAvailabilityMode availabilityMode) { + this.availabilityMode = availabilityMode; + return this; + } + + /** + * Get the availabilityModeDescription property: The Availability Synchronization mode of the availability group + * replica. + * + * @return the availabilityModeDescription value. + */ + public String availabilityModeDescription() { + return this.availabilityModeDescription; + } + + /** + * Get the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @return the failoverMode value. + */ + public ArcSqlServerFailoverMode failoverMode() { + return this.failoverMode; + } + + /** + * Set the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @param failoverMode the failoverMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withFailoverMode(ArcSqlServerFailoverMode failoverMode) { + this.failoverMode = failoverMode; + return this; + } + + /** + * Get the failoverModeDescription property: The failover mode of the availability group replica. + * + * @return the failoverModeDescription value. + */ + public String failoverModeDescription() { + return this.failoverModeDescription; + } + + /** + * Get the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @return the sessionTimeout value. + */ + public Integer sessionTimeout() { + return this.sessionTimeout; + } + + /** + * Set the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @param sessionTimeout the sessionTimeout value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withSessionTimeout(Integer sessionTimeout) { + this.sessionTimeout = sessionTimeout; + return this; + } + + /** + * Get the primaryAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @return the primaryAllowConnections value. + */ + public PrimaryAllowConnections primaryAllowConnections() { + return this.primaryAllowConnections; + } + + /** + * Set the primaryAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @param primaryAllowConnections the primaryAllowConnections value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withPrimaryAllowConnections(PrimaryAllowConnections primaryAllowConnections) { + this.primaryAllowConnections = primaryAllowConnections; + return this; + } + + /** + * Get the primaryRoleAllowConnectionsDescription property: Whether the availability allows all connections or only + * read-write connections. + * + * @return the primaryRoleAllowConnectionsDescription value. + */ + public String primaryRoleAllowConnectionsDescription() { + return this.primaryRoleAllowConnectionsDescription; + } + + /** + * Get the secondaryAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @return the secondaryAllowConnections value. + */ + public SecondaryAllowConnections secondaryAllowConnections() { + return this.secondaryAllowConnections; + } + + /** + * Set the secondaryAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @param secondaryAllowConnections the secondaryAllowConnections value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure + withSecondaryAllowConnections(SecondaryAllowConnections secondaryAllowConnections) { + this.secondaryAllowConnections = secondaryAllowConnections; + return this; + } + + /** + * Get the secondaryRoleAllowConnectionsDescription property: Whether an availability replica that is performing the + * secondary role (that is, a secondary replica) can accept connections from clients. + * + * @return the secondaryRoleAllowConnectionsDescription value. + */ + public String secondaryRoleAllowConnectionsDescription() { + return this.secondaryRoleAllowConnectionsDescription; + } + + /** + * Get the replicaCreateDate property: Date that the replica was created. + * + * @return the replicaCreateDate value. + */ + public OffsetDateTime replicaCreateDate() { + return this.replicaCreateDate; + } + + /** + * Get the replicaModifyDate property: Date that the replica was modified. + * + * @return the replicaModifyDate value. + */ + public OffsetDateTime replicaModifyDate() { + return this.replicaModifyDate; + } + + /** + * Get the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @return the backupPriority value. + */ + public Integer backupPriority() { + return this.backupPriority; + } + + /** + * Set the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @param backupPriority the backupPriority value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withBackupPriority(Integer backupPriority) { + this.backupPriority = backupPriority; + return this; + } + + /** + * Get the readOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability replica. + * + * @return the readOnlyRoutingUrl value. + */ + public String readOnlyRoutingUrl() { + return this.readOnlyRoutingUrl; + } + + /** + * Set the readOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability replica. + * + * @param readOnlyRoutingUrl the readOnlyRoutingUrl value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withReadOnlyRoutingUrl(String readOnlyRoutingUrl) { + this.readOnlyRoutingUrl = readOnlyRoutingUrl; + return this; + } + + /** + * Get the readWriteRoutingUrl property: Connectivity endpoint (URL) of the read write availability replica. + * + * @return the readWriteRoutingUrl value. + */ + public String readWriteRoutingUrl() { + return this.readWriteRoutingUrl; + } + + /** + * Set the readWriteRoutingUrl property: Connectivity endpoint (URL) of the read write availability replica. + * + * @param readWriteRoutingUrl the readWriteRoutingUrl value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withReadWriteRoutingUrl(String readWriteRoutingUrl) { + this.readWriteRoutingUrl = readWriteRoutingUrl; + return this; + } + + /** + * Get the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @return the seedingMode value. + */ + public SeedingMode seedingMode() { + return this.seedingMode; + } + + /** + * Set the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @param seedingMode the seedingMode value to set. + * @return the AvailabilityGroupConfigure object itself. + */ + public AvailabilityGroupConfigure withSeedingMode(SeedingMode seedingMode) { + this.seedingMode = seedingMode; + return this; + } + + /** + * Get the seedingModeDescription property: Describes seeding mode. + * + * @return the seedingModeDescription value. + */ + public String seedingModeDescription() { + return this.seedingModeDescription; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpointName", this.endpointName); + jsonWriter.writeStringField("endpointUrl", this.endpointUrl); + jsonWriter.writeStringField("endpointAuthenticationMode", + this.endpointAuthenticationMode == null ? null : this.endpointAuthenticationMode.toString()); + jsonWriter.writeStringField("certificateName", this.certificateName); + jsonWriter.writeStringField("endpointConnectLogin", this.endpointConnectLogin); + jsonWriter.writeStringField("availabilityMode", + this.availabilityMode == null ? null : this.availabilityMode.toString()); + jsonWriter.writeStringField("failoverMode", this.failoverMode == null ? null : this.failoverMode.toString()); + jsonWriter.writeNumberField("sessionTimeout", this.sessionTimeout); + jsonWriter.writeStringField("primaryAllowConnections", + this.primaryAllowConnections == null ? null : this.primaryAllowConnections.toString()); + jsonWriter.writeStringField("secondaryAllowConnections", + this.secondaryAllowConnections == null ? null : this.secondaryAllowConnections.toString()); + jsonWriter.writeNumberField("backupPriority", this.backupPriority); + jsonWriter.writeStringField("readOnlyRoutingUrl", this.readOnlyRoutingUrl); + jsonWriter.writeStringField("readWriteRoutingUrl", this.readWriteRoutingUrl); + jsonWriter.writeStringField("seedingMode", this.seedingMode == null ? null : this.seedingMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupConfigure from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupConfigure if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupConfigure. + */ + public static AvailabilityGroupConfigure fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupConfigure deserializedAvailabilityGroupConfigure = new AvailabilityGroupConfigure(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointName".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointName = reader.getString(); + } else if ("endpointUrl".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointUrl = reader.getString(); + } else if ("endpointAuthenticationMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointAuthenticationMode + = ConnectionAuth.fromString(reader.getString()); + } else if ("certificateName".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.certificateName = reader.getString(); + } else if ("endpointConnectLogin".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.endpointConnectLogin = reader.getString(); + } else if ("availabilityMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.availabilityMode + = ArcSqlServerAvailabilityMode.fromString(reader.getString()); + } else if ("availabilityModeDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.availabilityModeDescription = reader.getString(); + } else if ("failoverMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.failoverMode + = ArcSqlServerFailoverMode.fromString(reader.getString()); + } else if ("failoverModeDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.failoverModeDescription = reader.getString(); + } else if ("sessionTimeout".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.sessionTimeout = reader.getNullable(JsonReader::getInt); + } else if ("primaryAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.primaryAllowConnections + = PrimaryAllowConnections.fromString(reader.getString()); + } else if ("primaryRoleAllowConnectionsDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.primaryRoleAllowConnectionsDescription = reader.getString(); + } else if ("secondaryAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.secondaryAllowConnections + = SecondaryAllowConnections.fromString(reader.getString()); + } else if ("secondaryRoleAllowConnectionsDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.secondaryRoleAllowConnectionsDescription + = reader.getString(); + } else if ("replicaCreateDate".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.replicaCreateDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("replicaModifyDate".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.replicaModifyDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("backupPriority".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.backupPriority = reader.getNullable(JsonReader::getInt); + } else if ("readOnlyRoutingUrl".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.readOnlyRoutingUrl = reader.getString(); + } else if ("readWriteRoutingUrl".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.readWriteRoutingUrl = reader.getString(); + } else if ("seedingMode".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.seedingMode = SeedingMode.fromString(reader.getString()); + } else if ("seedingModeDescription".equals(fieldName)) { + deserializedAvailabilityGroupConfigure.seedingModeDescription = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupConfigure; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java new file mode 100644 index 000000000000..b5555a7b1346 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Options used in creating an availability group. + */ +@Fluent +public final class AvailabilityGroupCreateUpdateConfiguration + implements JsonSerializable { + /* + * Name of the availability group. + */ + private String availabilityGroupName; + + /* + * List of availability group replicas. + */ + private List replicas; + + /* + * List of databases to include in the availability group. + */ + private List databases; + + /* + * Preferred replica for running automated backups. + */ + private AutomatedBackupPreference automatedBackupPreference; + + /* + * User-defined failure condition level under which an automatic failover must be triggered. + */ + private FailureConditionLevel failureConditionLevel; + + /* + * Wait time (in milliseconds) for the sp_server_diagnostics system stored procedure to return server-health + * information, before the server instance is assumed to be slow or not responding. + */ + private Integer healthCheckTimeout; + + /* + * Specifies whether the availability group supports failover for database health conditions. + */ + private DbFailover dbFailover; + + /* + * Specifies whether DTC support has been enabled for this availability group. + */ + private DtcSupport dtcSupport; + + /* + * The number of secondary replicas that must be in a synchronized state for a commit to complete. + */ + private Integer requiredSynchronizedSecondariesToCommit; + + /* + * Set to WSFC when availability group is on a failover cluster instance on a Windows Server failover cluster. Set + * to NONE when availability group not using WSFC for cluster coordination. + */ + private ClusterType clusterType; + + /* + * The listener for the sql server availability group + */ + private SqlAvailabilityGroupStaticIPListenerProperties listener; + + /** + * Creates an instance of AvailabilityGroupCreateUpdateConfiguration class. + */ + public AvailabilityGroupCreateUpdateConfiguration() { + } + + /** + * Get the availabilityGroupName property: Name of the availability group. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: Name of the availability group. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the replicas property: List of availability group replicas. + * + * @return the replicas value. + */ + public List replicas() { + return this.replicas; + } + + /** + * Set the replicas property: List of availability group replicas. + * + * @param replicas the replicas value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withReplicas(List replicas) { + this.replicas = replicas; + return this; + } + + /** + * Get the databases property: List of databases to include in the availability group. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases property: List of databases to include in the availability group. + * + * @param databases the databases value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Get the automatedBackupPreference property: Preferred replica for running automated backups. + * + * @return the automatedBackupPreference value. + */ + public AutomatedBackupPreference automatedBackupPreference() { + return this.automatedBackupPreference; + } + + /** + * Set the automatedBackupPreference property: Preferred replica for running automated backups. + * + * @param automatedBackupPreference the automatedBackupPreference value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withAutomatedBackupPreference(AutomatedBackupPreference automatedBackupPreference) { + this.automatedBackupPreference = automatedBackupPreference; + return this; + } + + /** + * Get the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @return the failureConditionLevel value. + */ + public FailureConditionLevel failureConditionLevel() { + return this.failureConditionLevel; + } + + /** + * Set the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @param failureConditionLevel the failureConditionLevel value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withFailureConditionLevel(FailureConditionLevel failureConditionLevel) { + this.failureConditionLevel = failureConditionLevel; + return this; + } + + /** + * Get the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @return the healthCheckTimeout value. + */ + public Integer healthCheckTimeout() { + return this.healthCheckTimeout; + } + + /** + * Set the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @param healthCheckTimeout the healthCheckTimeout value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withHealthCheckTimeout(Integer healthCheckTimeout) { + this.healthCheckTimeout = healthCheckTimeout; + return this; + } + + /** + * Get the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @return the dbFailover value. + */ + public DbFailover dbFailover() { + return this.dbFailover; + } + + /** + * Set the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @param dbFailover the dbFailover value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withDbFailover(DbFailover dbFailover) { + this.dbFailover = dbFailover; + return this; + } + + /** + * Get the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @return the dtcSupport value. + */ + public DtcSupport dtcSupport() { + return this.dtcSupport; + } + + /** + * Set the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @param dtcSupport the dtcSupport value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withDtcSupport(DtcSupport dtcSupport) { + this.dtcSupport = dtcSupport; + return this; + } + + /** + * Get the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @return the requiredSynchronizedSecondariesToCommit value. + */ + public Integer requiredSynchronizedSecondariesToCommit() { + return this.requiredSynchronizedSecondariesToCommit; + } + + /** + * Set the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @param requiredSynchronizedSecondariesToCommit the requiredSynchronizedSecondariesToCommit value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withRequiredSynchronizedSecondariesToCommit(Integer requiredSynchronizedSecondariesToCommit) { + this.requiredSynchronizedSecondariesToCommit = requiredSynchronizedSecondariesToCommit; + return this; + } + + /** + * Get the clusterType property: Set to WSFC when availability group is on a failover cluster instance on a Windows + * Server failover cluster. Set to NONE when availability group not using WSFC for cluster coordination. + * + * @return the clusterType value. + */ + public ClusterType clusterType() { + return this.clusterType; + } + + /** + * Set the clusterType property: Set to WSFC when availability group is on a failover cluster instance on a Windows + * Server failover cluster. Set to NONE when availability group not using WSFC for cluster coordination. + * + * @param clusterType the clusterType value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration withClusterType(ClusterType clusterType) { + this.clusterType = clusterType; + return this; + } + + /** + * Get the listener property: The listener for the sql server availability group. + * + * @return the listener value. + */ + public SqlAvailabilityGroupStaticIPListenerProperties listener() { + return this.listener; + } + + /** + * Set the listener property: The listener for the sql server availability group. + * + * @param listener the listener value to set. + * @return the AvailabilityGroupCreateUpdateConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateConfiguration + withListener(SqlAvailabilityGroupStaticIPListenerProperties listener) { + this.listener = listener; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroupName", this.availabilityGroupName); + jsonWriter.writeArrayField("replicas", this.replicas, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("databases", this.databases, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("automatedBackupPreference", + this.automatedBackupPreference == null ? null : this.automatedBackupPreference.toString()); + jsonWriter.writeNumberField("failureConditionLevel", + this.failureConditionLevel == null ? null : this.failureConditionLevel.toInt()); + jsonWriter.writeNumberField("healthCheckTimeout", this.healthCheckTimeout); + jsonWriter.writeStringField("dbFailover", this.dbFailover == null ? null : this.dbFailover.toString()); + jsonWriter.writeStringField("dtcSupport", this.dtcSupport == null ? null : this.dtcSupport.toString()); + jsonWriter.writeNumberField("requiredSynchronizedSecondariesToCommit", + this.requiredSynchronizedSecondariesToCommit); + jsonWriter.writeStringField("clusterType", this.clusterType == null ? null : this.clusterType.toString()); + jsonWriter.writeJsonField("listener", this.listener); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupCreateUpdateConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupCreateUpdateConfiguration if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupCreateUpdateConfiguration. + */ + public static AvailabilityGroupCreateUpdateConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupCreateUpdateConfiguration deserializedAvailabilityGroupCreateUpdateConfiguration + = new AvailabilityGroupCreateUpdateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupName".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.availabilityGroupName = reader.getString(); + } else if ("replicas".equals(fieldName)) { + List replicas = reader + .readArray(reader1 -> AvailabilityGroupCreateUpdateReplicaConfiguration.fromJson(reader1)); + deserializedAvailabilityGroupCreateUpdateConfiguration.replicas = replicas; + } else if ("databases".equals(fieldName)) { + List databases = reader.readArray(reader1 -> reader1.getString()); + deserializedAvailabilityGroupCreateUpdateConfiguration.databases = databases; + } else if ("automatedBackupPreference".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.automatedBackupPreference + = AutomatedBackupPreference.fromString(reader.getString()); + } else if ("failureConditionLevel".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.failureConditionLevel + = FailureConditionLevel.fromInt(reader.getInt()); + } else if ("healthCheckTimeout".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.healthCheckTimeout + = reader.getNullable(JsonReader::getInt); + } else if ("dbFailover".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.dbFailover + = DbFailover.fromString(reader.getString()); + } else if ("dtcSupport".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.dtcSupport + = DtcSupport.fromString(reader.getString()); + } else if ("requiredSynchronizedSecondariesToCommit".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.requiredSynchronizedSecondariesToCommit + = reader.getNullable(JsonReader::getInt); + } else if ("clusterType".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.clusterType + = ClusterType.fromString(reader.getString()); + } else if ("listener".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateConfiguration.listener + = SqlAvailabilityGroupStaticIPListenerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupCreateUpdateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java new file mode 100644 index 000000000000..b48d1697c87e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java @@ -0,0 +1,528 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The specifications of the availability group replica configuration. + */ +@Fluent +public final class AvailabilityGroupCreateUpdateReplicaConfiguration + implements JsonSerializable { + /* + * the server instance hosting the replica. + */ + private String serverInstance; + + /* + * Name of the database mirroring endpoint URL for the availability group replica + */ + private String endpointName; + + /* + * Database mirroring endpoint URL of availability group replica + */ + private String endpointUrl; + + /* + * Permitted authentication modes for the mirroring endpoint. + */ + private ConnectionAuth endpointAuthenticationMode; + + /* + * Name of certificate to use for authentication. Required if any CERTIFICATE authentication modes are specified. + */ + private String certificateName; + + /* + * The login which will connect to the mirroring endpoint + */ + private String endpointConnectLogin; + + /* + * Property that determines whether a given availability replica can run in synchronous-commit mode + */ + private ArcSqlServerAvailabilityMode availabilityMode; + + /* + * Property to set the failover mode of the availability group replica + */ + private ArcSqlServerFailoverMode failoverMode; + + /* + * Specifies how the secondary replica will be initially seeded. AUTOMATIC enables direct seeding. This method will + * seed the secondary replica over the network. This method does not require you to backup and restore a copy of the + * primary database on the replica. MANUAL specifies manual seeding (default). This method requires you to create a + * backup of the database on the primary replica and manually restore that backup on the secondary replica. + */ + private SeedingMode seedingMode; + + /* + * Represents the user-specified priority for performing backups on this replica relative to the other replicas in + * the same availability group. + */ + private Integer backupPriority; + + /* + * Whether the secondary replica should allow all connections, no connections, or only ReadOnly connections. + */ + private SecondaryAllowConnections secondaryRoleAllowConnections; + + /* + * Connectivity endpoint (URL) of the read only availability replica. + */ + private String secondaryRoleReadOnlyRoutingUrl; + + /* + * Whether the primary replica should allow all connections or only READ_WRITE connections (disallowing ReadOnly + * connections) + */ + private PrimaryAllowConnections primaryRoleAllowConnections; + + /* + * List of read only routing URLs. + */ + private List primaryRoleReadOnlyRoutingList; + + /* + * The time-out period of availability group session replica, in seconds. + */ + private Integer sessionTimeout; + + /** + * Creates an instance of AvailabilityGroupCreateUpdateReplicaConfiguration class. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration() { + } + + /** + * Get the serverInstance property: the server instance hosting the replica. + * + * @return the serverInstance value. + */ + public String serverInstance() { + return this.serverInstance; + } + + /** + * Set the serverInstance property: the server instance hosting the replica. + * + * @param serverInstance the serverInstance value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withServerInstance(String serverInstance) { + this.serverInstance = serverInstance; + return this; + } + + /** + * Get the endpointName property: Name of the database mirroring endpoint URL for the availability group replica. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Set the endpointName property: Name of the database mirroring endpoint URL for the availability group replica. + * + * @param endpointName the endpointName value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withEndpointName(String endpointName) { + this.endpointName = endpointName; + return this; + } + + /** + * Get the endpointUrl property: Database mirroring endpoint URL of availability group replica. + * + * @return the endpointUrl value. + */ + public String endpointUrl() { + return this.endpointUrl; + } + + /** + * Set the endpointUrl property: Database mirroring endpoint URL of availability group replica. + * + * @param endpointUrl the endpointUrl value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withEndpointUrl(String endpointUrl) { + this.endpointUrl = endpointUrl; + return this; + } + + /** + * Get the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @return the endpointAuthenticationMode value. + */ + public ConnectionAuth endpointAuthenticationMode() { + return this.endpointAuthenticationMode; + } + + /** + * Set the endpointAuthenticationMode property: Permitted authentication modes for the mirroring endpoint. + * + * @param endpointAuthenticationMode the endpointAuthenticationMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withEndpointAuthenticationMode(ConnectionAuth endpointAuthenticationMode) { + this.endpointAuthenticationMode = endpointAuthenticationMode; + return this; + } + + /** + * Get the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Set the certificateName property: Name of certificate to use for authentication. Required if any CERTIFICATE + * authentication modes are specified. + * + * @param certificateName the certificateName value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withCertificateName(String certificateName) { + this.certificateName = certificateName; + return this; + } + + /** + * Get the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @return the endpointConnectLogin value. + */ + public String endpointConnectLogin() { + return this.endpointConnectLogin; + } + + /** + * Set the endpointConnectLogin property: The login which will connect to the mirroring endpoint. + * + * @param endpointConnectLogin the endpointConnectLogin value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withEndpointConnectLogin(String endpointConnectLogin) { + this.endpointConnectLogin = endpointConnectLogin; + return this; + } + + /** + * Get the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @return the availabilityMode value. + */ + public ArcSqlServerAvailabilityMode availabilityMode() { + return this.availabilityMode; + } + + /** + * Set the availabilityMode property: Property that determines whether a given availability replica can run in + * synchronous-commit mode. + * + * @param availabilityMode the availabilityMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withAvailabilityMode(ArcSqlServerAvailabilityMode availabilityMode) { + this.availabilityMode = availabilityMode; + return this; + } + + /** + * Get the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @return the failoverMode value. + */ + public ArcSqlServerFailoverMode failoverMode() { + return this.failoverMode; + } + + /** + * Set the failoverMode property: Property to set the failover mode of the availability group replica. + * + * @param failoverMode the failoverMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withFailoverMode(ArcSqlServerFailoverMode failoverMode) { + this.failoverMode = failoverMode; + return this; + } + + /** + * Get the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @return the seedingMode value. + */ + public SeedingMode seedingMode() { + return this.seedingMode; + } + + /** + * Set the seedingMode property: Specifies how the secondary replica will be initially seeded. AUTOMATIC enables + * direct seeding. This method will seed the secondary replica over the network. This method does not require you to + * backup and restore a copy of the primary database on the replica. MANUAL specifies manual seeding (default). This + * method requires you to create a backup of the database on the primary replica and manually restore that backup on + * the secondary replica. + * + * @param seedingMode the seedingMode value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withSeedingMode(SeedingMode seedingMode) { + this.seedingMode = seedingMode; + return this; + } + + /** + * Get the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @return the backupPriority value. + */ + public Integer backupPriority() { + return this.backupPriority; + } + + /** + * Set the backupPriority property: Represents the user-specified priority for performing backups on this replica + * relative to the other replicas in the same availability group. + * + * @param backupPriority the backupPriority value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withBackupPriority(Integer backupPriority) { + this.backupPriority = backupPriority; + return this; + } + + /** + * Get the secondaryRoleAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @return the secondaryRoleAllowConnections value. + */ + public SecondaryAllowConnections secondaryRoleAllowConnections() { + return this.secondaryRoleAllowConnections; + } + + /** + * Set the secondaryRoleAllowConnections property: Whether the secondary replica should allow all connections, no + * connections, or only ReadOnly connections. + * + * @param secondaryRoleAllowConnections the secondaryRoleAllowConnections value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withSecondaryRoleAllowConnections(SecondaryAllowConnections secondaryRoleAllowConnections) { + this.secondaryRoleAllowConnections = secondaryRoleAllowConnections; + return this; + } + + /** + * Get the secondaryRoleReadOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability + * replica. + * + * @return the secondaryRoleReadOnlyRoutingUrl value. + */ + public String secondaryRoleReadOnlyRoutingUrl() { + return this.secondaryRoleReadOnlyRoutingUrl; + } + + /** + * Set the secondaryRoleReadOnlyRoutingUrl property: Connectivity endpoint (URL) of the read only availability + * replica. + * + * @param secondaryRoleReadOnlyRoutingUrl the secondaryRoleReadOnlyRoutingUrl value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withSecondaryRoleReadOnlyRoutingUrl(String secondaryRoleReadOnlyRoutingUrl) { + this.secondaryRoleReadOnlyRoutingUrl = secondaryRoleReadOnlyRoutingUrl; + return this; + } + + /** + * Get the primaryRoleAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @return the primaryRoleAllowConnections value. + */ + public PrimaryAllowConnections primaryRoleAllowConnections() { + return this.primaryRoleAllowConnections; + } + + /** + * Set the primaryRoleAllowConnections property: Whether the primary replica should allow all connections or only + * READ_WRITE connections (disallowing ReadOnly connections). + * + * @param primaryRoleAllowConnections the primaryRoleAllowConnections value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withPrimaryRoleAllowConnections(PrimaryAllowConnections primaryRoleAllowConnections) { + this.primaryRoleAllowConnections = primaryRoleAllowConnections; + return this; + } + + /** + * Get the primaryRoleReadOnlyRoutingList property: List of read only routing URLs. + * + * @return the primaryRoleReadOnlyRoutingList value. + */ + public List primaryRoleReadOnlyRoutingList() { + return this.primaryRoleReadOnlyRoutingList; + } + + /** + * Set the primaryRoleReadOnlyRoutingList property: List of read only routing URLs. + * + * @param primaryRoleReadOnlyRoutingList the primaryRoleReadOnlyRoutingList value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration + withPrimaryRoleReadOnlyRoutingList(List primaryRoleReadOnlyRoutingList) { + this.primaryRoleReadOnlyRoutingList = primaryRoleReadOnlyRoutingList; + return this; + } + + /** + * Get the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @return the sessionTimeout value. + */ + public Integer sessionTimeout() { + return this.sessionTimeout; + } + + /** + * Set the sessionTimeout property: The time-out period of availability group session replica, in seconds. + * + * @param sessionTimeout the sessionTimeout value to set. + * @return the AvailabilityGroupCreateUpdateReplicaConfiguration object itself. + */ + public AvailabilityGroupCreateUpdateReplicaConfiguration withSessionTimeout(Integer sessionTimeout) { + this.sessionTimeout = sessionTimeout; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serverInstance", this.serverInstance); + jsonWriter.writeStringField("endpointName", this.endpointName); + jsonWriter.writeStringField("endpointUrl", this.endpointUrl); + jsonWriter.writeStringField("endpointAuthenticationMode", + this.endpointAuthenticationMode == null ? null : this.endpointAuthenticationMode.toString()); + jsonWriter.writeStringField("certificateName", this.certificateName); + jsonWriter.writeStringField("endpointConnectLogin", this.endpointConnectLogin); + jsonWriter.writeStringField("availabilityMode", + this.availabilityMode == null ? null : this.availabilityMode.toString()); + jsonWriter.writeStringField("failoverMode", this.failoverMode == null ? null : this.failoverMode.toString()); + jsonWriter.writeStringField("seedingMode", this.seedingMode == null ? null : this.seedingMode.toString()); + jsonWriter.writeNumberField("backupPriority", this.backupPriority); + jsonWriter.writeStringField("secondaryRoleAllowConnections", + this.secondaryRoleAllowConnections == null ? null : this.secondaryRoleAllowConnections.toString()); + jsonWriter.writeStringField("secondaryRoleReadOnlyRoutingUrl", this.secondaryRoleReadOnlyRoutingUrl); + jsonWriter.writeStringField("primaryRoleAllowConnections", + this.primaryRoleAllowConnections == null ? null : this.primaryRoleAllowConnections.toString()); + jsonWriter.writeArrayField("primaryRoleReadOnlyRoutingList", this.primaryRoleReadOnlyRoutingList, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("sessionTimeout", this.sessionTimeout); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupCreateUpdateReplicaConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupCreateUpdateReplicaConfiguration if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupCreateUpdateReplicaConfiguration. + */ + public static AvailabilityGroupCreateUpdateReplicaConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupCreateUpdateReplicaConfiguration deserializedAvailabilityGroupCreateUpdateReplicaConfiguration + = new AvailabilityGroupCreateUpdateReplicaConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serverInstance".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.serverInstance = reader.getString(); + } else if ("endpointName".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointName = reader.getString(); + } else if ("endpointUrl".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointUrl = reader.getString(); + } else if ("endpointAuthenticationMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointAuthenticationMode + = ConnectionAuth.fromString(reader.getString()); + } else if ("certificateName".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.certificateName = reader.getString(); + } else if ("endpointConnectLogin".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.endpointConnectLogin + = reader.getString(); + } else if ("availabilityMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.availabilityMode + = ArcSqlServerAvailabilityMode.fromString(reader.getString()); + } else if ("failoverMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.failoverMode + = ArcSqlServerFailoverMode.fromString(reader.getString()); + } else if ("seedingMode".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.seedingMode + = SeedingMode.fromString(reader.getString()); + } else if ("backupPriority".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.backupPriority + = reader.getNullable(JsonReader::getInt); + } else if ("secondaryRoleAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.secondaryRoleAllowConnections + = SecondaryAllowConnections.fromString(reader.getString()); + } else if ("secondaryRoleReadOnlyRoutingUrl".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.secondaryRoleReadOnlyRoutingUrl + = reader.getString(); + } else if ("primaryRoleAllowConnections".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.primaryRoleAllowConnections + = PrimaryAllowConnections.fromString(reader.getString()); + } else if ("primaryRoleReadOnlyRoutingList".equals(fieldName)) { + List primaryRoleReadOnlyRoutingList = reader.readArray(reader1 -> reader1.getString()); + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.primaryRoleReadOnlyRoutingList + = primaryRoleReadOnlyRoutingList; + } else if ("sessionTimeout".equals(fieldName)) { + deserializedAvailabilityGroupCreateUpdateReplicaConfiguration.sessionTimeout + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupCreateUpdateReplicaConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java new file mode 100644 index 000000000000..99d9c5ccf660 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The specifications of the availability group state. + */ +@Fluent +public final class AvailabilityGroupInfo implements JsonSerializable { + /* + * User-defined failure condition level under which an automatic failover must be triggered. + */ + private Integer failureConditionLevel; + + /* + * Wait time (in milliseconds) for the sp_server_diagnostics system stored procedure to return server-health + * information, before the server instance is assumed to be slow or not responding. + */ + private Integer healthCheckTimeout; + + /* + * Preferred location for performing backups on the availability databases in this availability group. + */ + private String automatedBackupPreferenceDescription; + + /* + * SQL Server availability group current version. + */ + private Integer version; + + /* + * Specifies whether this is a basic availability group. + */ + private Boolean basicFeatures; + + /* + * Specifies whether DTC support has been enabled for this availability group. + */ + private Boolean dtcSupport; + + /* + * Specifies whether the availability group supports failover for database health conditions. + */ + private Boolean dbFailover; + + /* + * Specifies whether this is a distributed availability group. + */ + private Boolean isDistributed; + + /* + * SQL Server availability group cluster type description + */ + private String clusterTypeDescription; + + /* + * The number of secondary replicas that must be in a synchronized state for a commit to complete. + */ + private Integer requiredSynchronizedSecondariesToCommit; + + /* + * SQL Server availability group contained system databases. + */ + private Boolean isContained; + + /* + * Name of the server instance that is hosting the current primary replica. + */ + private String primaryReplica; + + /* + * Indicates the recovery health of the primary replica. + */ + private String primaryRecoveryHealthDescription; + + /* + * Indicates the recovery health of a secondary replica. + */ + private String secondaryRecoveryHealthDescription; + + /* + * Reflects a roll-up of the synchronization health of all availability replicas in the availability group. + */ + private String synchronizationHealthDescription; + + /* + * The replicationPartnerType property. + */ + private ReplicationPartnerType replicationPartnerType; + + /* + * The listener for the sql server availability group + */ + private SqlAvailabilityGroupStaticIPListenerProperties listener; + + /** + * Creates an instance of AvailabilityGroupInfo class. + */ + public AvailabilityGroupInfo() { + } + + /** + * Get the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @return the failureConditionLevel value. + */ + public Integer failureConditionLevel() { + return this.failureConditionLevel; + } + + /** + * Set the failureConditionLevel property: User-defined failure condition level under which an automatic failover + * must be triggered. + * + * @param failureConditionLevel the failureConditionLevel value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withFailureConditionLevel(Integer failureConditionLevel) { + this.failureConditionLevel = failureConditionLevel; + return this; + } + + /** + * Get the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @return the healthCheckTimeout value. + */ + public Integer healthCheckTimeout() { + return this.healthCheckTimeout; + } + + /** + * Set the healthCheckTimeout property: Wait time (in milliseconds) for the sp_server_diagnostics system stored + * procedure to return server-health information, before the server instance is assumed to be slow or not + * responding. + * + * @param healthCheckTimeout the healthCheckTimeout value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withHealthCheckTimeout(Integer healthCheckTimeout) { + this.healthCheckTimeout = healthCheckTimeout; + return this; + } + + /** + * Get the automatedBackupPreferenceDescription property: Preferred location for performing backups on the + * availability databases in this availability group. + * + * @return the automatedBackupPreferenceDescription value. + */ + public String automatedBackupPreferenceDescription() { + return this.automatedBackupPreferenceDescription; + } + + /** + * Get the version property: SQL Server availability group current version. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Get the basicFeatures property: Specifies whether this is a basic availability group. + * + * @return the basicFeatures value. + */ + public Boolean basicFeatures() { + return this.basicFeatures; + } + + /** + * Set the basicFeatures property: Specifies whether this is a basic availability group. + * + * @param basicFeatures the basicFeatures value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withBasicFeatures(Boolean basicFeatures) { + this.basicFeatures = basicFeatures; + return this; + } + + /** + * Get the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @return the dtcSupport value. + */ + public Boolean dtcSupport() { + return this.dtcSupport; + } + + /** + * Set the dtcSupport property: Specifies whether DTC support has been enabled for this availability group. + * + * @param dtcSupport the dtcSupport value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withDtcSupport(Boolean dtcSupport) { + this.dtcSupport = dtcSupport; + return this; + } + + /** + * Get the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @return the dbFailover value. + */ + public Boolean dbFailover() { + return this.dbFailover; + } + + /** + * Set the dbFailover property: Specifies whether the availability group supports failover for database health + * conditions. + * + * @param dbFailover the dbFailover value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withDbFailover(Boolean dbFailover) { + this.dbFailover = dbFailover; + return this; + } + + /** + * Get the isDistributed property: Specifies whether this is a distributed availability group. + * + * @return the isDistributed value. + */ + public Boolean isDistributed() { + return this.isDistributed; + } + + /** + * Set the isDistributed property: Specifies whether this is a distributed availability group. + * + * @param isDistributed the isDistributed value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withIsDistributed(Boolean isDistributed) { + this.isDistributed = isDistributed; + return this; + } + + /** + * Get the clusterTypeDescription property: SQL Server availability group cluster type description. + * + * @return the clusterTypeDescription value. + */ + public String clusterTypeDescription() { + return this.clusterTypeDescription; + } + + /** + * Get the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @return the requiredSynchronizedSecondariesToCommit value. + */ + public Integer requiredSynchronizedSecondariesToCommit() { + return this.requiredSynchronizedSecondariesToCommit; + } + + /** + * Set the requiredSynchronizedSecondariesToCommit property: The number of secondary replicas that must be in a + * synchronized state for a commit to complete. + * + * @param requiredSynchronizedSecondariesToCommit the requiredSynchronizedSecondariesToCommit value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo + withRequiredSynchronizedSecondariesToCommit(Integer requiredSynchronizedSecondariesToCommit) { + this.requiredSynchronizedSecondariesToCommit = requiredSynchronizedSecondariesToCommit; + return this; + } + + /** + * Get the isContained property: SQL Server availability group contained system databases. + * + * @return the isContained value. + */ + public Boolean isContained() { + return this.isContained; + } + + /** + * Set the isContained property: SQL Server availability group contained system databases. + * + * @param isContained the isContained value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withIsContained(Boolean isContained) { + this.isContained = isContained; + return this; + } + + /** + * Get the primaryReplica property: Name of the server instance that is hosting the current primary replica. + * + * @return the primaryReplica value. + */ + public String primaryReplica() { + return this.primaryReplica; + } + + /** + * Get the primaryRecoveryHealthDescription property: Indicates the recovery health of the primary replica. + * + * @return the primaryRecoveryHealthDescription value. + */ + public String primaryRecoveryHealthDescription() { + return this.primaryRecoveryHealthDescription; + } + + /** + * Get the secondaryRecoveryHealthDescription property: Indicates the recovery health of a secondary replica. + * + * @return the secondaryRecoveryHealthDescription value. + */ + public String secondaryRecoveryHealthDescription() { + return this.secondaryRecoveryHealthDescription; + } + + /** + * Get the synchronizationHealthDescription property: Reflects a roll-up of the synchronization health of all + * availability replicas in the availability group. + * + * @return the synchronizationHealthDescription value. + */ + public String synchronizationHealthDescription() { + return this.synchronizationHealthDescription; + } + + /** + * Get the replicationPartnerType property: The replicationPartnerType property. + * + * @return the replicationPartnerType value. + */ + public ReplicationPartnerType replicationPartnerType() { + return this.replicationPartnerType; + } + + /** + * Get the listener property: The listener for the sql server availability group. + * + * @return the listener value. + */ + public SqlAvailabilityGroupStaticIPListenerProperties listener() { + return this.listener; + } + + /** + * Set the listener property: The listener for the sql server availability group. + * + * @param listener the listener value to set. + * @return the AvailabilityGroupInfo object itself. + */ + public AvailabilityGroupInfo withListener(SqlAvailabilityGroupStaticIPListenerProperties listener) { + this.listener = listener; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("failureConditionLevel", this.failureConditionLevel); + jsonWriter.writeNumberField("healthCheckTimeout", this.healthCheckTimeout); + jsonWriter.writeBooleanField("basicFeatures", this.basicFeatures); + jsonWriter.writeBooleanField("dtcSupport", this.dtcSupport); + jsonWriter.writeBooleanField("dbFailover", this.dbFailover); + jsonWriter.writeBooleanField("isDistributed", this.isDistributed); + jsonWriter.writeNumberField("requiredSynchronizedSecondariesToCommit", + this.requiredSynchronizedSecondariesToCommit); + jsonWriter.writeBooleanField("isContained", this.isContained); + jsonWriter.writeJsonField("listener", this.listener); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupInfo. + */ + public static AvailabilityGroupInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupInfo deserializedAvailabilityGroupInfo = new AvailabilityGroupInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("failureConditionLevel".equals(fieldName)) { + deserializedAvailabilityGroupInfo.failureConditionLevel = reader.getNullable(JsonReader::getInt); + } else if ("healthCheckTimeout".equals(fieldName)) { + deserializedAvailabilityGroupInfo.healthCheckTimeout = reader.getNullable(JsonReader::getInt); + } else if ("automatedBackupPreferenceDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.automatedBackupPreferenceDescription = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedAvailabilityGroupInfo.version = reader.getNullable(JsonReader::getInt); + } else if ("basicFeatures".equals(fieldName)) { + deserializedAvailabilityGroupInfo.basicFeatures = reader.getNullable(JsonReader::getBoolean); + } else if ("dtcSupport".equals(fieldName)) { + deserializedAvailabilityGroupInfo.dtcSupport = reader.getNullable(JsonReader::getBoolean); + } else if ("dbFailover".equals(fieldName)) { + deserializedAvailabilityGroupInfo.dbFailover = reader.getNullable(JsonReader::getBoolean); + } else if ("isDistributed".equals(fieldName)) { + deserializedAvailabilityGroupInfo.isDistributed = reader.getNullable(JsonReader::getBoolean); + } else if ("clusterTypeDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.clusterTypeDescription = reader.getString(); + } else if ("requiredSynchronizedSecondariesToCommit".equals(fieldName)) { + deserializedAvailabilityGroupInfo.requiredSynchronizedSecondariesToCommit + = reader.getNullable(JsonReader::getInt); + } else if ("isContained".equals(fieldName)) { + deserializedAvailabilityGroupInfo.isContained = reader.getNullable(JsonReader::getBoolean); + } else if ("primaryReplica".equals(fieldName)) { + deserializedAvailabilityGroupInfo.primaryReplica = reader.getString(); + } else if ("primaryRecoveryHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.primaryRecoveryHealthDescription = reader.getString(); + } else if ("secondaryRecoveryHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.secondaryRecoveryHealthDescription = reader.getString(); + } else if ("synchronizationHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupInfo.synchronizationHealthDescription = reader.getString(); + } else if ("replicationPartnerType".equals(fieldName)) { + deserializedAvailabilityGroupInfo.replicationPartnerType + = ReplicationPartnerType.fromString(reader.getString()); + } else if ("listener".equals(fieldName)) { + deserializedAvailabilityGroupInfo.listener + = SqlAvailabilityGroupStaticIPListenerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupInfo; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupRetrievalFilters.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupRetrievalFilters.java new file mode 100644 index 000000000000..475457f4d111 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupRetrievalFilters.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AvailabilityGroupRetrievalFilters model. + */ +@Fluent +public final class AvailabilityGroupRetrievalFilters implements JsonSerializable { + /* + * Filter retrieval based on availability group type. + */ + private ArcSqlServerAvailabilityGroupTypeFilter availabilityGroupTypeFilter; + + /* + * The replicationPartnerTypeFilter property. + */ + private ReplicationPartnerType replicationPartnerTypeFilter; + + /** + * Creates an instance of AvailabilityGroupRetrievalFilters class. + */ + public AvailabilityGroupRetrievalFilters() { + } + + /** + * Get the availabilityGroupTypeFilter property: Filter retrieval based on availability group type. + * + * @return the availabilityGroupTypeFilter value. + */ + public ArcSqlServerAvailabilityGroupTypeFilter availabilityGroupTypeFilter() { + return this.availabilityGroupTypeFilter; + } + + /** + * Set the availabilityGroupTypeFilter property: Filter retrieval based on availability group type. + * + * @param availabilityGroupTypeFilter the availabilityGroupTypeFilter value to set. + * @return the AvailabilityGroupRetrievalFilters object itself. + */ + public AvailabilityGroupRetrievalFilters + withAvailabilityGroupTypeFilter(ArcSqlServerAvailabilityGroupTypeFilter availabilityGroupTypeFilter) { + this.availabilityGroupTypeFilter = availabilityGroupTypeFilter; + return this; + } + + /** + * Get the replicationPartnerTypeFilter property: The replicationPartnerTypeFilter property. + * + * @return the replicationPartnerTypeFilter value. + */ + public ReplicationPartnerType replicationPartnerTypeFilter() { + return this.replicationPartnerTypeFilter; + } + + /** + * Set the replicationPartnerTypeFilter property: The replicationPartnerTypeFilter property. + * + * @param replicationPartnerTypeFilter the replicationPartnerTypeFilter value to set. + * @return the AvailabilityGroupRetrievalFilters object itself. + */ + public AvailabilityGroupRetrievalFilters + withReplicationPartnerTypeFilter(ReplicationPartnerType replicationPartnerTypeFilter) { + this.replicationPartnerTypeFilter = replicationPartnerTypeFilter; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroupTypeFilter", + this.availabilityGroupTypeFilter == null ? null : this.availabilityGroupTypeFilter.toString()); + jsonWriter.writeStringField("replicationPartnerTypeFilter", + this.replicationPartnerTypeFilter == null ? null : this.replicationPartnerTypeFilter.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupRetrievalFilters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupRetrievalFilters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupRetrievalFilters. + */ + public static AvailabilityGroupRetrievalFilters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupRetrievalFilters deserializedAvailabilityGroupRetrievalFilters + = new AvailabilityGroupRetrievalFilters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupTypeFilter".equals(fieldName)) { + deserializedAvailabilityGroupRetrievalFilters.availabilityGroupTypeFilter + = ArcSqlServerAvailabilityGroupTypeFilter.fromString(reader.getString()); + } else if ("replicationPartnerTypeFilter".equals(fieldName)) { + deserializedAvailabilityGroupRetrievalFilters.replicationPartnerTypeFilter + = ReplicationPartnerType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupRetrievalFilters; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java new file mode 100644 index 000000000000..b694c25f9da7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The specifications of the availability group state. + */ +@Immutable +public final class AvailabilityGroupState implements JsonSerializable { + /* + * Current Always On availability groups role of the availability group replica. + */ + private String availabilityGroupReplicaRole; + + /* + * Current operational state of the availability group replica + */ + private String operationalStateDescription; + + /* + * Recovery health of the availability group replica. + */ + private String recoveryHealthDescription; + + /* + * Reflects a rollup of the database synchronization state (synchronization_state) of all joined availability + * databases (also known as replicas) and the availability mode of the replica (synchronous-commit or + * asynchronous-commit mode). The rollup will reflect the least healthy accumulated state the databases on the + * replica. + */ + private String synchronizationHealthDescription; + + /* + * Whether a secondary replica is currently connected to the primary replica. + */ + private String connectedStateDescription; + + /* + * Text description of the last connection error of the availability group replica. + */ + private String lastConnectErrorDescription; + + /* + * Date and time timestamp indicating when the last connect error occurred. + */ + private OffsetDateTime lastConnectErrorTimestamp; + + /** + * Creates an instance of AvailabilityGroupState class. + */ + public AvailabilityGroupState() { + } + + /** + * Get the availabilityGroupReplicaRole property: Current Always On availability groups role of the availability + * group replica. + * + * @return the availabilityGroupReplicaRole value. + */ + public String availabilityGroupReplicaRole() { + return this.availabilityGroupReplicaRole; + } + + /** + * Get the operationalStateDescription property: Current operational state of the availability group replica. + * + * @return the operationalStateDescription value. + */ + public String operationalStateDescription() { + return this.operationalStateDescription; + } + + /** + * Get the recoveryHealthDescription property: Recovery health of the availability group replica. + * + * @return the recoveryHealthDescription value. + */ + public String recoveryHealthDescription() { + return this.recoveryHealthDescription; + } + + /** + * Get the synchronizationHealthDescription property: Reflects a rollup of the database synchronization state + * (synchronization_state) of all joined availability databases (also known as replicas) and the availability mode + * of the replica (synchronous-commit or asynchronous-commit mode). The rollup will reflect the least healthy + * accumulated state the databases on the replica. + * + * @return the synchronizationHealthDescription value. + */ + public String synchronizationHealthDescription() { + return this.synchronizationHealthDescription; + } + + /** + * Get the connectedStateDescription property: Whether a secondary replica is currently connected to the primary + * replica. + * + * @return the connectedStateDescription value. + */ + public String connectedStateDescription() { + return this.connectedStateDescription; + } + + /** + * Get the lastConnectErrorDescription property: Text description of the last connection error of the availability + * group replica. + * + * @return the lastConnectErrorDescription value. + */ + public String lastConnectErrorDescription() { + return this.lastConnectErrorDescription; + } + + /** + * Get the lastConnectErrorTimestamp property: Date and time timestamp indicating when the last connect error + * occurred. + * + * @return the lastConnectErrorTimestamp value. + */ + public OffsetDateTime lastConnectErrorTimestamp() { + return this.lastConnectErrorTimestamp; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailabilityGroupState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailabilityGroupState if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AvailabilityGroupState. + */ + public static AvailabilityGroupState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailabilityGroupState deserializedAvailabilityGroupState = new AvailabilityGroupState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupReplicaRole".equals(fieldName)) { + deserializedAvailabilityGroupState.availabilityGroupReplicaRole = reader.getString(); + } else if ("operationalStateDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.operationalStateDescription = reader.getString(); + } else if ("recoveryHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.recoveryHealthDescription = reader.getString(); + } else if ("synchronizationHealthDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.synchronizationHealthDescription = reader.getString(); + } else if ("connectedStateDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.connectedStateDescription = reader.getString(); + } else if ("lastConnectErrorDescription".equals(fieldName)) { + deserializedAvailabilityGroupState.lastConnectErrorDescription = reader.getString(); + } else if ("lastConnectErrorTimestamp".equals(fieldName)) { + deserializedAvailabilityGroupState.lastConnectErrorTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAvailabilityGroupState; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AzureManagedInstanceRole.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AzureManagedInstanceRole.java new file mode 100644 index 000000000000..d192ac68db6b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/AzureManagedInstanceRole.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The role of managed instance in a distributed availability group, can be Primary or Secondary. + */ +public final class AzureManagedInstanceRole extends ExpandableStringEnum { + /** + * Primary. + */ + public static final AzureManagedInstanceRole PRIMARY = fromString("Primary"); + + /** + * Secondary. + */ + public static final AzureManagedInstanceRole SECONDARY = fromString("Secondary"); + + /** + * Creates a new instance of AzureManagedInstanceRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AzureManagedInstanceRole() { + } + + /** + * Creates or finds a AzureManagedInstanceRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureManagedInstanceRole. + */ + public static AzureManagedInstanceRole fromString(String name) { + return fromString(name, AzureManagedInstanceRole.class); + } + + /** + * Gets known AzureManagedInstanceRole values. + * + * @return known AzureManagedInstanceRole values. + */ + public static Collection values() { + return values(AzureManagedInstanceRole.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java new file mode 100644 index 000000000000..9298eb617be3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The background job details. + */ +@Immutable +public final class BackgroundJob implements JsonSerializable { + /* + * The state of the background job. + */ + private State state; + + /* + * The execution state of the background job. + */ + private ExecutionState executionState; + + /* + * The start time of the background job. + */ + private OffsetDateTime startTime; + + /* + * The end time of the background job. + */ + private OffsetDateTime endTime; + + /* + * The last execution status of the background job. + */ + private LastExecutionStatus lastExecutionStatus; + + /* + * The last execution time of the background job in ISO 8601 date-time format. + */ + private OffsetDateTime lastExecutionTime; + + /* + * The next execution time of the background job in ISO 8601 date-time format. + */ + private OffsetDateTime nextExecutionTime; + + /** + * Creates an instance of BackgroundJob class. + */ + private BackgroundJob() { + } + + /** + * Get the state property: The state of the background job. + * + * @return the state value. + */ + public State state() { + return this.state; + } + + /** + * Get the executionState property: The execution state of the background job. + * + * @return the executionState value. + */ + public ExecutionState executionState() { + return this.executionState; + } + + /** + * Get the startTime property: The start time of the background job. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time of the background job. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the lastExecutionStatus property: The last execution status of the background job. + * + * @return the lastExecutionStatus value. + */ + public LastExecutionStatus lastExecutionStatus() { + return this.lastExecutionStatus; + } + + /** + * Get the lastExecutionTime property: The last execution time of the background job in ISO 8601 date-time format. + * + * @return the lastExecutionTime value. + */ + public OffsetDateTime lastExecutionTime() { + return this.lastExecutionTime; + } + + /** + * Get the nextExecutionTime property: The next execution time of the background job in ISO 8601 date-time format. + * + * @return the nextExecutionTime value. + */ + public OffsetDateTime nextExecutionTime() { + return this.nextExecutionTime; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("executionState", + this.executionState == null ? null : this.executionState.toString()); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("lastExecutionStatus", + this.lastExecutionStatus == null ? null : this.lastExecutionStatus.toString()); + jsonWriter.writeStringField("lastExecutionTime", + this.lastExecutionTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastExecutionTime)); + jsonWriter.writeStringField("nextExecutionTime", + this.nextExecutionTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nextExecutionTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackgroundJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackgroundJob if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackgroundJob. + */ + public static BackgroundJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackgroundJob deserializedBackgroundJob = new BackgroundJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedBackgroundJob.state = State.fromString(reader.getString()); + } else if ("executionState".equals(fieldName)) { + deserializedBackgroundJob.executionState = ExecutionState.fromString(reader.getString()); + } else if ("startTime".equals(fieldName)) { + deserializedBackgroundJob.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedBackgroundJob.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastExecutionStatus".equals(fieldName)) { + deserializedBackgroundJob.lastExecutionStatus = LastExecutionStatus.fromString(reader.getString()); + } else if ("lastExecutionTime".equals(fieldName)) { + deserializedBackgroundJob.lastExecutionTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("nextExecutionTime".equals(fieldName)) { + deserializedBackgroundJob.nextExecutionTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedBackgroundJob; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java new file mode 100644 index 000000000000..0141cc84125b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The backup profile for the SQL server. + */ +@Fluent +public final class BackupPolicy implements JsonSerializable { + /* + * The retention period for all the databases in this managed instance. + */ + private Integer retentionPeriodDays; + + /* + * The value indicating days between full backups. + */ + private Integer fullBackupDays; + + /* + * The differential backup interval in hours. + */ + private DifferentialBackupHours differentialBackupHours; + + /* + * The value indicating minutes between transaction log backups. + */ + private Integer transactionLogBackupMinutes; + + /** + * Creates an instance of BackupPolicy class. + */ + public BackupPolicy() { + } + + /** + * Get the retentionPeriodDays property: The retention period for all the databases in this managed instance. + * + * @return the retentionPeriodDays value. + */ + public Integer retentionPeriodDays() { + return this.retentionPeriodDays; + } + + /** + * Set the retentionPeriodDays property: The retention period for all the databases in this managed instance. + * + * @param retentionPeriodDays the retentionPeriodDays value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withRetentionPeriodDays(Integer retentionPeriodDays) { + this.retentionPeriodDays = retentionPeriodDays; + return this; + } + + /** + * Get the fullBackupDays property: The value indicating days between full backups. + * + * @return the fullBackupDays value. + */ + public Integer fullBackupDays() { + return this.fullBackupDays; + } + + /** + * Set the fullBackupDays property: The value indicating days between full backups. + * + * @param fullBackupDays the fullBackupDays value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withFullBackupDays(Integer fullBackupDays) { + this.fullBackupDays = fullBackupDays; + return this; + } + + /** + * Get the differentialBackupHours property: The differential backup interval in hours. + * + * @return the differentialBackupHours value. + */ + public DifferentialBackupHours differentialBackupHours() { + return this.differentialBackupHours; + } + + /** + * Set the differentialBackupHours property: The differential backup interval in hours. + * + * @param differentialBackupHours the differentialBackupHours value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withDifferentialBackupHours(DifferentialBackupHours differentialBackupHours) { + this.differentialBackupHours = differentialBackupHours; + return this; + } + + /** + * Get the transactionLogBackupMinutes property: The value indicating minutes between transaction log backups. + * + * @return the transactionLogBackupMinutes value. + */ + public Integer transactionLogBackupMinutes() { + return this.transactionLogBackupMinutes; + } + + /** + * Set the transactionLogBackupMinutes property: The value indicating minutes between transaction log backups. + * + * @param transactionLogBackupMinutes the transactionLogBackupMinutes value to set. + * @return the BackupPolicy object itself. + */ + public BackupPolicy withTransactionLogBackupMinutes(Integer transactionLogBackupMinutes) { + this.transactionLogBackupMinutes = transactionLogBackupMinutes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("retentionPeriodDays", this.retentionPeriodDays); + jsonWriter.writeNumberField("fullBackupDays", this.fullBackupDays); + jsonWriter.writeNumberField("differentialBackupHours", + this.differentialBackupHours == null ? null : this.differentialBackupHours.toInt()); + jsonWriter.writeNumberField("transactionLogBackupMinutes", this.transactionLogBackupMinutes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupPolicy. + */ + public static BackupPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupPolicy deserializedBackupPolicy = new BackupPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionPeriodDays".equals(fieldName)) { + deserializedBackupPolicy.retentionPeriodDays = reader.getNullable(JsonReader::getInt); + } else if ("fullBackupDays".equals(fieldName)) { + deserializedBackupPolicy.fullBackupDays = reader.getNullable(JsonReader::getInt); + } else if ("differentialBackupHours".equals(fieldName)) { + deserializedBackupPolicy.differentialBackupHours = DifferentialBackupHours.fromInt(reader.getInt()); + } else if ("transactionLogBackupMinutes".equals(fieldName)) { + deserializedBackupPolicy.transactionLogBackupMinutes = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupPolicy; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java index 4dd4fd08cdc1..44f98a33f3bc 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -72,14 +72,6 @@ public BasicLoginInformation withPassword(String password) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BestPracticesAssessment.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BestPracticesAssessment.java new file mode 100644 index 000000000000..61ca0c530cb4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BestPracticesAssessment.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The configuration related to SQL best practices assessment. + */ +@Fluent +public final class BestPracticesAssessment implements JsonSerializable { + /* + * Indicates if SQL best practices assessment is enabled for the SQL Server instance. + */ + private Boolean enabled; + + /* + * The scheduling configuration. + */ + private Schedule schedule; + + /** + * Creates an instance of BestPracticesAssessment class. + */ + public BestPracticesAssessment() { + } + + /** + * Get the enabled property: Indicates if SQL best practices assessment is enabled for the SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if SQL best practices assessment is enabled for the SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the BestPracticesAssessment object itself. + */ + public BestPracticesAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the schedule property: The scheduling configuration. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The scheduling configuration. + * + * @param schedule the schedule value to set. + * @return the BestPracticesAssessment object itself. + */ + public BestPracticesAssessment withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeJsonField("schedule", this.schedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BestPracticesAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BestPracticesAssessment if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BestPracticesAssessment. + */ + public static BestPracticesAssessment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BestPracticesAssessment deserializedBestPracticesAssessment = new BestPracticesAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedBestPracticesAssessment.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("schedule".equals(fieldName)) { + deserializedBestPracticesAssessment.schedule = Schedule.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBestPracticesAssessment; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.java new file mode 100644 index 000000000000..45b9c6bc1f28 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * SQL Server ESU license type. + */ +public final class BillingPlan extends ExpandableStringEnum { + /** + * PAYG. + */ + public static final BillingPlan PAYG = fromString("PAYG"); + + /** + * Paid. + */ + public static final BillingPlan PAID = fromString("Paid"); + + /** + * Creates a new instance of BillingPlan value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingPlan() { + } + + /** + * Creates or finds a BillingPlan from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingPlan. + */ + public static BillingPlan fromString(String name) { + return fromString(name, BillingPlan.class); + } + + /** + * Gets known BillingPlan values. + * + * @return known BillingPlan values. + */ + public static Collection values() { + return values(BillingPlan.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java new file mode 100644 index 000000000000..302da6a5e44c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Client connection related configuration. + */ +@Fluent +public final class ClientConnection implements JsonSerializable { + /* + * Indicates if client connection is enabled for this SQL Server instance. + */ + private Boolean enabled; + + /** + * Creates an instance of ClientConnection class. + */ + public ClientConnection() { + } + + /** + * Get the enabled property: Indicates if client connection is enabled for this SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if client connection is enabled for this SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the ClientConnection object itself. + */ + public ClientConnection withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientConnection if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ClientConnection. + */ + public static ClientConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientConnection deserializedClientConnection = new ClientConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedClientConnection.enabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedClientConnection; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.java new file mode 100644 index 000000000000..98dee995fd4b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Set to WSFC when availability group is on a failover cluster instance on a Windows Server failover cluster. Set to + * NONE when availability group not using WSFC for cluster coordination. + */ +public enum ClusterType { + /** + * WSFC. + */ + WSFC("WSFC"), + + /** + * NONE. + */ + NONE("NONE"); + + /** + * The actual serialized value for a ClusterType instance. + */ + private final String value; + + ClusterType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ClusterType instance. + * + * @param value the serialized value to parse. + * @return the parsed ClusterType object, or null if unable to parse. + */ + public static ClusterType fromString(String value) { + if (value == null) { + return null; + } + ClusterType[] items = ClusterType.values(); + for (ClusterType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java new file mode 100644 index 000000000000..044cc1266d37 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource model definition representing SKU for ARM resources. + */ +@Fluent +public class CommonSku implements JsonSerializable { + /* + * The name of the SKU. It is typically a letter+number code + */ + private String name; + + /* + * Whether dev/test is enabled. When the dev field is set to true, the resource is used for dev/test purpose. + */ + private Boolean dev; + + /* + * The SKU size. When the name field is the combination of tier and some other value, this would be the standalone + * code. + */ + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, then that can be captured here. + */ + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible + * for the resource this may be omitted. + */ + private Integer capacity; + + /** + * Creates an instance of CommonSku class. + */ + public CommonSku() { + } + + /** + * Get the name property: The name of the SKU. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. It is typically a letter+number code. + * + * @param name the name value to set. + * @return the CommonSku object itself. + */ + public CommonSku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dev property: Whether dev/test is enabled. When the dev field is set to true, the resource is used for + * dev/test purpose. + * + * @return the dev value. + */ + public Boolean dev() { + return this.dev; + } + + /** + * Set the dev property: Whether dev/test is enabled. When the dev field is set to true, the resource is used for + * dev/test purpose. + * + * @param dev the dev value to set. + * @return the CommonSku object itself. + */ + public CommonSku withDev(Boolean dev) { + this.dev = dev; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the CommonSku object itself. + */ + public CommonSku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the CommonSku object itself. + */ + public CommonSku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the CommonSku object itself. + */ + public CommonSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeBooleanField("dev", this.dev); + jsonWriter.writeStringField("size", this.size); + jsonWriter.writeStringField("family", this.family); + jsonWriter.writeNumberField("capacity", this.capacity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommonSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommonSku if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommonSku. + */ + public static CommonSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommonSku deserializedCommonSku = new CommonSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCommonSku.name = reader.getString(); + } else if ("dev".equals(fieldName)) { + deserializedCommonSku.dev = reader.getNullable(JsonReader::getBoolean); + } else if ("size".equals(fieldName)) { + deserializedCommonSku.size = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedCommonSku.family = reader.getString(); + } else if ("capacity".equals(fieldName)) { + deserializedCommonSku.capacity = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCommonSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java new file mode 100644 index 000000000000..881ecbdcf56b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The endpoint connection authentication type(s). + */ +public final class ConnectionAuth extends ExpandableStringEnum { + /** + * Windows_NTLM. + */ + public static final ConnectionAuth WINDOWS_NTLM = fromString("Windows_NTLM"); + + /** + * Windows_Kerberos. + */ + public static final ConnectionAuth WINDOWS_KERBEROS = fromString("Windows_Kerberos"); + + /** + * Windows_Negotiate. + */ + public static final ConnectionAuth WINDOWS_NEGOTIATE = fromString("Windows_Negotiate"); + + /** + * Certificate. + */ + public static final ConnectionAuth CERTIFICATE = fromString("Certificate"); + + /** + * Windows_NTLM_Certificate. + */ + public static final ConnectionAuth WINDOWS_NTLM_CERTIFICATE = fromString("Windows_NTLM_Certificate"); + + /** + * Windows_Kerberos_Certificate. + */ + public static final ConnectionAuth WINDOWS_KERBEROS_CERTIFICATE = fromString("Windows_Kerberos_Certificate"); + + /** + * Windows_Negotiate_Certificate. + */ + public static final ConnectionAuth WINDOWS_NEGOTIATE_CERTIFICATE = fromString("Windows_Negotiate_Certificate"); + + /** + * Certificate_Windows_NTLM. + */ + public static final ConnectionAuth CERTIFICATE_WINDOWS_NTLM = fromString("Certificate_Windows_NTLM"); + + /** + * Certificate_Windows_Kerberos. + */ + public static final ConnectionAuth CERTIFICATE_WINDOWS_KERBEROS = fromString("Certificate_Windows_Kerberos"); + + /** + * Certificate_Windows_Negotiate. + */ + public static final ConnectionAuth CERTIFICATE_WINDOWS_NEGOTIATE = fromString("Certificate_Windows_Negotiate"); + + /** + * Creates a new instance of ConnectionAuth value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectionAuth() { + } + + /** + * Creates or finds a ConnectionAuth from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionAuth. + */ + public static ConnectionAuth fromString(String name) { + return fromString(name, ConnectionAuth.class); + } + + /** + * Gets known ConnectionAuth values. + * + * @return known ConnectionAuth values. + */ + public static Collection values() { + return values(ConnectionAuth.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java index 85ec11f9eebb..99adeac2a66f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -12,17 +12,27 @@ */ public final class ConnectionStatus extends ExpandableStringEnum { /** - * Static value Connected for ConnectionStatus. + * Connected. */ public static final ConnectionStatus CONNECTED = fromString("Connected"); /** - * Static value Disconnected for ConnectionStatus. + * Disconnected. */ public static final ConnectionStatus DISCONNECTED = fromString("Disconnected"); /** - * Static value Unknown for ConnectionStatus. + * Registered. + */ + public static final ConnectionStatus REGISTERED = fromString("Registered"); + + /** + * Discovered. + */ + public static final ConnectionStatus DISCOVERED = fromString("Discovered"); + + /** + * Unknown. */ public static final ConnectionStatus UNKNOWN = fromString("Unknown"); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CostOptionSelectedValues.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CostOptionSelectedValues.java new file mode 100644 index 000000000000..5b7791db56d6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CostOptionSelectedValues.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cost option value for the different cost factors selected. + */ +@Fluent +public final class CostOptionSelectedValues implements JsonSerializable { + /* + * selected cost saving option e.g. With1YearASPAndDevTest. + */ + private String computeAndStorageCostOption; + + /* + * With Azure Hybrid Benefit(AHB) or not for SQL. + */ + private String sqlLicenseCostOption; + + /* + * With Azure Hybrid Benefit(AHB) or not for Windows. + */ + private String windowsLicenseCostOption; + + /** + * Creates an instance of CostOptionSelectedValues class. + */ + public CostOptionSelectedValues() { + } + + /** + * Get the computeAndStorageCostOption property: selected cost saving option e.g. With1YearASPAndDevTest. + * + * @return the computeAndStorageCostOption value. + */ + public String computeAndStorageCostOption() { + return this.computeAndStorageCostOption; + } + + /** + * Set the computeAndStorageCostOption property: selected cost saving option e.g. With1YearASPAndDevTest. + * + * @param computeAndStorageCostOption the computeAndStorageCostOption value to set. + * @return the CostOptionSelectedValues object itself. + */ + public CostOptionSelectedValues withComputeAndStorageCostOption(String computeAndStorageCostOption) { + this.computeAndStorageCostOption = computeAndStorageCostOption; + return this; + } + + /** + * Get the sqlLicenseCostOption property: With Azure Hybrid Benefit(AHB) or not for SQL. + * + * @return the sqlLicenseCostOption value. + */ + public String sqlLicenseCostOption() { + return this.sqlLicenseCostOption; + } + + /** + * Set the sqlLicenseCostOption property: With Azure Hybrid Benefit(AHB) or not for SQL. + * + * @param sqlLicenseCostOption the sqlLicenseCostOption value to set. + * @return the CostOptionSelectedValues object itself. + */ + public CostOptionSelectedValues withSqlLicenseCostOption(String sqlLicenseCostOption) { + this.sqlLicenseCostOption = sqlLicenseCostOption; + return this; + } + + /** + * Get the windowsLicenseCostOption property: With Azure Hybrid Benefit(AHB) or not for Windows. + * + * @return the windowsLicenseCostOption value. + */ + public String windowsLicenseCostOption() { + return this.windowsLicenseCostOption; + } + + /** + * Set the windowsLicenseCostOption property: With Azure Hybrid Benefit(AHB) or not for Windows. + * + * @param windowsLicenseCostOption the windowsLicenseCostOption value to set. + * @return the CostOptionSelectedValues object itself. + */ + public CostOptionSelectedValues withWindowsLicenseCostOption(String windowsLicenseCostOption) { + this.windowsLicenseCostOption = windowsLicenseCostOption; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computeAndStorageCostOption", this.computeAndStorageCostOption); + jsonWriter.writeStringField("sqlLicenseCostOption", this.sqlLicenseCostOption); + jsonWriter.writeStringField("windowsLicenseCostOption", this.windowsLicenseCostOption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CostOptionSelectedValues from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CostOptionSelectedValues if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CostOptionSelectedValues. + */ + public static CostOptionSelectedValues fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CostOptionSelectedValues deserializedCostOptionSelectedValues = new CostOptionSelectedValues(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeAndStorageCostOption".equals(fieldName)) { + deserializedCostOptionSelectedValues.computeAndStorageCostOption = reader.getString(); + } else if ("sqlLicenseCostOption".equals(fieldName)) { + deserializedCostOptionSelectedValues.sqlLicenseCostOption = reader.getString(); + } else if ("windowsLicenseCostOption".equals(fieldName)) { + deserializedCostOptionSelectedValues.windowsLicenseCostOption = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCostOptionSelectedValues; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CostTypeValues.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CostTypeValues.java new file mode 100644 index 000000000000..82f35aa3b844 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CostTypeValues.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Monthly cost of the particular SKU. + */ +@Immutable +public final class CostTypeValues implements JsonSerializable { + /* + * Represents the Cost of Compute. + */ + private Double computeCost; + + /* + * Represents the Cost of Storage. + */ + private Double storageCost; + + /* + * Represents the Cost of IOPS. + */ + private Double iopsCost; + + /** + * Creates an instance of CostTypeValues class. + */ + private CostTypeValues() { + } + + /** + * Get the computeCost property: Represents the Cost of Compute. + * + * @return the computeCost value. + */ + public Double computeCost() { + return this.computeCost; + } + + /** + * Get the storageCost property: Represents the Cost of Storage. + * + * @return the storageCost value. + */ + public Double storageCost() { + return this.storageCost; + } + + /** + * Get the iopsCost property: Represents the Cost of IOPS. + * + * @return the iopsCost value. + */ + public Double iopsCost() { + return this.iopsCost; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("computeCost", this.computeCost); + jsonWriter.writeNumberField("storageCost", this.storageCost); + jsonWriter.writeNumberField("iopsCost", this.iopsCost); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CostTypeValues from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CostTypeValues if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CostTypeValues. + */ + public static CostTypeValues fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CostTypeValues deserializedCostTypeValues = new CostTypeValues(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeCost".equals(fieldName)) { + deserializedCostTypeValues.computeCost = reader.getNullable(JsonReader::getDouble); + } else if ("storageCost".equals(fieldName)) { + deserializedCostTypeValues.storageCost = reader.getNullable(JsonReader::getDouble); + } else if ("iopsCost".equals(fieldName)) { + deserializedCostTypeValues.iopsCost = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedCostTypeValues; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CronTrigger.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CronTrigger.java new file mode 100644 index 000000000000..9b3efbef7a1a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/CronTrigger.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The cron trigger configuration. + */ +@Fluent +public final class CronTrigger implements JsonSerializable { + /* + * Indicates the start time for the trigger. The default value is the time at which the trigger was created. + */ + private String startTime; + + /* + * The time zone in which the trigger is scheduled. + */ + private String timeZone; + + /* + * A cron string representing a CronTab expression. A crontab expression is a very compact way to express a + * recurring schedule with the following format: '{minutes} {hours} {days} {months} {days-of-week}'. + */ + private String expression; + + /** + * Creates an instance of CronTrigger class. + */ + public CronTrigger() { + } + + /** + * Get the startTime property: Indicates the start time for the trigger. The default value is the time at which the + * trigger was created. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Indicates the start time for the trigger. The default value is the time at which the + * trigger was created. + * + * @param startTime the startTime value to set. + * @return the CronTrigger object itself. + */ + public CronTrigger withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the timeZone property: The time zone in which the trigger is scheduled. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: The time zone in which the trigger is scheduled. + * + * @param timeZone the timeZone value to set. + * @return the CronTrigger object itself. + */ + public CronTrigger withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the expression property: A cron string representing a CronTab expression. A crontab expression is a very + * compact way to express a recurring schedule with the following format: '{minutes} {hours} {days} {months} + * {days-of-week}'. + * + * @return the expression value. + */ + public String expression() { + return this.expression; + } + + /** + * Set the expression property: A cron string representing a CronTab expression. A crontab expression is a very + * compact way to express a recurring schedule with the following format: '{minutes} {hours} {days} {months} + * {days-of-week}'. + * + * @param expression the expression value to set. + * @return the CronTrigger object itself. + */ + public CronTrigger withExpression(String expression) { + this.expression = expression; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startTime", this.startTime); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeStringField("expression", this.expression); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CronTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CronTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CronTrigger. + */ + public static CronTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CronTrigger deserializedCronTrigger = new CronTrigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedCronTrigger.startTime = reader.getString(); + } else if ("timeZone".equals(fieldName)) { + deserializedCronTrigger.timeZone = reader.getString(); + } else if ("expression".equals(fieldName)) { + deserializedCronTrigger.expression = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCronTrigger; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DBMEndpoint.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DBMEndpoint.java new file mode 100644 index 000000000000..ed8aa1898eeb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DBMEndpoint.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Database mirroring endpoint related properties. + */ +@Immutable +public final class DBMEndpoint implements JsonSerializable { + /* + * Name of the database mirroring endpoint. + */ + private String endpointName; + + /* + * Mirroring Role + */ + private Role role; + + /* + * Is Encryption enabled + */ + private Boolean isEncryptionEnabled; + + /* + * Encryption Algorithm + */ + private EncryptionAlgorithm encryptionAlgorithm; + + /* + * The type of connection authentication required for connections to this endpoint + */ + private ConnectionAuth connectionAuth; + + /* + * The port number that the endpoint is listening on. + */ + private Integer port; + + /* + * Is the port number dynamically assigned. + */ + private Boolean isDynamicPort; + + /* + * Listener IP address. + */ + private String ipAddress; + + /* + * Name of the certificate. + */ + private String certificateName; + + /* + * The certificate expiry date + */ + private OffsetDateTime certificateExpiryDate; + + /** + * Creates an instance of DBMEndpoint class. + */ + public DBMEndpoint() { + } + + /** + * Get the endpointName property: Name of the database mirroring endpoint. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Get the role property: Mirroring Role. + * + * @return the role value. + */ + public Role role() { + return this.role; + } + + /** + * Get the isEncryptionEnabled property: Is Encryption enabled. + * + * @return the isEncryptionEnabled value. + */ + public Boolean isEncryptionEnabled() { + return this.isEncryptionEnabled; + } + + /** + * Get the encryptionAlgorithm property: Encryption Algorithm. + * + * @return the encryptionAlgorithm value. + */ + public EncryptionAlgorithm encryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Get the connectionAuth property: The type of connection authentication required for connections to this endpoint. + * + * @return the connectionAuth value. + */ + public ConnectionAuth connectionAuth() { + return this.connectionAuth; + } + + /** + * Get the port property: The port number that the endpoint is listening on. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Get the isDynamicPort property: Is the port number dynamically assigned. + * + * @return the isDynamicPort value. + */ + public Boolean isDynamicPort() { + return this.isDynamicPort; + } + + /** + * Get the ipAddress property: Listener IP address. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Get the certificateName property: Name of the certificate. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Get the certificateExpiryDate property: The certificate expiry date. + * + * @return the certificateExpiryDate value. + */ + public OffsetDateTime certificateExpiryDate() { + return this.certificateExpiryDate; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DBMEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DBMEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DBMEndpoint. + */ + public static DBMEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DBMEndpoint deserializedDBMEndpoint = new DBMEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointName".equals(fieldName)) { + deserializedDBMEndpoint.endpointName = reader.getString(); + } else if ("role".equals(fieldName)) { + deserializedDBMEndpoint.role = Role.fromString(reader.getString()); + } else if ("isEncryptionEnabled".equals(fieldName)) { + deserializedDBMEndpoint.isEncryptionEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("encryptionAlgorithm".equals(fieldName)) { + deserializedDBMEndpoint.encryptionAlgorithm = EncryptionAlgorithm.fromString(reader.getString()); + } else if ("connectionAuth".equals(fieldName)) { + deserializedDBMEndpoint.connectionAuth = ConnectionAuth.fromString(reader.getString()); + } else if ("port".equals(fieldName)) { + deserializedDBMEndpoint.port = reader.getNullable(JsonReader::getInt); + } else if ("isDynamicPort".equals(fieldName)) { + deserializedDBMEndpoint.isDynamicPort = reader.getNullable(JsonReader::getBoolean); + } else if ("ipAddress".equals(fieldName)) { + deserializedDBMEndpoint.ipAddress = reader.getString(); + } else if ("certificateName".equals(fieldName)) { + deserializedDBMEndpoint.certificateName = reader.getString(); + } else if ("certificateExpiryDate".equals(fieldName)) { + deserializedDBMEndpoint.certificateExpiryDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDBMEndpoint; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java new file mode 100644 index 000000000000..9d2732d332de --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Migration related configuration. + */ +@Fluent +public final class DataBaseMigration implements JsonSerializable { + /* + * Migration assessments related configuration. + */ + private DataBaseMigrationAssessment assessment; + + /* + * Migration jobs/actual data movement/data migrations associated with this database related information. + */ + private List jobs; + + /** + * Creates an instance of DataBaseMigration class. + */ + public DataBaseMigration() { + } + + /** + * Get the assessment property: Migration assessments related configuration. + * + * @return the assessment value. + */ + public DataBaseMigrationAssessment assessment() { + return this.assessment; + } + + /** + * Set the assessment property: Migration assessments related configuration. + * + * @param assessment the assessment value to set. + * @return the DataBaseMigration object itself. + */ + public DataBaseMigration withAssessment(DataBaseMigrationAssessment assessment) { + this.assessment = assessment; + return this; + } + + /** + * Get the jobs property: Migration jobs/actual data movement/data migrations associated with this database related + * information. + * + * @return the jobs value. + */ + public List jobs() { + return this.jobs; + } + + /** + * Set the jobs property: Migration jobs/actual data movement/data migrations associated with this database related + * information. + * + * @param jobs the jobs value to set. + * @return the DataBaseMigration object itself. + */ + public DataBaseMigration withJobs(List jobs) { + this.jobs = jobs; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("assessment", this.assessment); + jsonWriter.writeArrayField("jobs", this.jobs, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataBaseMigration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataBaseMigration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DataBaseMigration. + */ + public static DataBaseMigration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataBaseMigration deserializedDataBaseMigration = new DataBaseMigration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessment".equals(fieldName)) { + deserializedDataBaseMigration.assessment = DataBaseMigrationAssessment.fromJson(reader); + } else if ("jobs".equals(fieldName)) { + List jobs + = reader.readArray(reader1 -> DatabaseMigrationJobsItem.fromJson(reader1)); + deserializedDataBaseMigration.jobs = jobs; + } else { + reader.skipChildren(); + } + } + + return deserializedDataBaseMigration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java new file mode 100644 index 000000000000..8764c3d15ebd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * The migration assessment related configuration. + */ +@Immutable +public final class DataBaseMigrationAssessment implements JsonSerializable { + /* + * The time when Migration Assessment Report upload was last performed. + */ + private OffsetDateTime assessmentUploadTime; + + /* + * The UTC timestamp in ISO 8601 format indicating when the latest target recommendations were generated for this + * database. This value is set as part of a successful RunTargetRecommendation job and is independent of when the + * migration readiness results were uploaded (assessmentUploadTime). + */ + private OffsetDateTime targetRecommendationGenerationTime; + + /* + * Issues and warnings impacting the migration of Database to particular Azure Migration Target. + */ + private List databaseAssessments; + + /* + * The target readiness for migration for this database. + */ + private TargetReadiness targetReadiness; + + /** + * Creates an instance of DataBaseMigrationAssessment class. + */ + public DataBaseMigrationAssessment() { + } + + /** + * Get the assessmentUploadTime property: The time when Migration Assessment Report upload was last performed. + * + * @return the assessmentUploadTime value. + */ + public OffsetDateTime assessmentUploadTime() { + return this.assessmentUploadTime; + } + + /** + * Get the targetRecommendationGenerationTime property: The UTC timestamp in ISO 8601 format indicating when the + * latest target recommendations were generated for this database. This value is set as part of a successful + * RunTargetRecommendation job and is independent of when the migration readiness results were uploaded + * (assessmentUploadTime). + * + * @return the targetRecommendationGenerationTime value. + */ + public OffsetDateTime targetRecommendationGenerationTime() { + return this.targetRecommendationGenerationTime; + } + + /** + * Get the databaseAssessments property: Issues and warnings impacting the migration of Database to particular Azure + * Migration Target. + * + * @return the databaseAssessments value. + */ + public List databaseAssessments() { + return this.databaseAssessments; + } + + /** + * Get the targetReadiness property: The target readiness for migration for this database. + * + * @return the targetReadiness value. + */ + public TargetReadiness targetReadiness() { + return this.targetReadiness; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataBaseMigrationAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataBaseMigrationAssessment if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DataBaseMigrationAssessment. + */ + public static DataBaseMigrationAssessment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataBaseMigrationAssessment deserializedDataBaseMigrationAssessment = new DataBaseMigrationAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessmentUploadTime".equals(fieldName)) { + deserializedDataBaseMigrationAssessment.assessmentUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("targetRecommendationGenerationTime".equals(fieldName)) { + deserializedDataBaseMigrationAssessment.targetRecommendationGenerationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("databaseAssessments".equals(fieldName)) { + List databaseAssessments + = reader.readArray(reader1 -> DatabaseAssessmentsItem.fromJson(reader1)); + deserializedDataBaseMigrationAssessment.databaseAssessments = databaseAssessments; + } else if ("targetReadiness".equals(fieldName)) { + deserializedDataBaseMigrationAssessment.targetReadiness = TargetReadiness.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataBaseMigrationAssessment; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java index 4a45f681df75..cc0419c29470 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -45,22 +45,33 @@ public final class DataControllerProperties implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("basicLoginInformation".equals(fieldName)) { deserializedDataControllerProperties.basicLoginInformation = BasicLoginInformation.fromJson(reader); + } else if ("metricsDashboardCredential".equals(fieldName)) { + deserializedDataControllerProperties.metricsDashboardCredential + = BasicLoginInformation.fromJson(reader); + } else if ("logsDashboardCredential".equals(fieldName)) { + deserializedDataControllerProperties.logsDashboardCredential + = BasicLoginInformation.fromJson(reader); } else if ("logAnalyticsWorkspaceConfig".equals(fieldName)) { deserializedDataControllerProperties.logAnalyticsWorkspaceConfig = LogAnalyticsWorkspaceConfig.fromJson(reader); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java index 097d39ea21b9..af3c49a8870f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -50,21 +50,21 @@ public interface DataControllerResource { Map tags(); /** - * Gets the extendedLocation property: The extendedLocation of the resource. + * Gets the properties property: The data controller's properties. * - * @return the extendedLocation value. + * @return the properties value. */ - ExtendedLocation extendedLocation(); + DataControllerProperties properties(); /** - * Gets the properties property: The data controller's properties. + * Gets the extendedLocation property: The extendedLocation of the resource. * - * @return the properties value. + * @return the extendedLocation value. */ - DataControllerProperties properties(); + ExtendedLocation extendedLocation(); /** - * Gets the systemData property: Read only system data. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -143,7 +143,7 @@ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ WithProperties withExistingResourceGroup(String resourceGroupName); @@ -220,7 +220,7 @@ interface WithExtendedLocation { /** * The template for DataControllerResource update. */ - interface Update extends UpdateStages.WithTags { + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { /** * Executes the update request. * @@ -253,6 +253,19 @@ interface WithTags { */ Update withTags(Map tags); } + + /** + * The stage of the DataControllerResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The data controller's properties. + * + * @param properties The data controller's properties. + * @return the next definition stage. + */ + Update withProperties(DataControllerProperties properties); + } } /** diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java index c9bd8fddc84c..8cc1cbeefbbc 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -22,6 +22,11 @@ public final class DataControllerUpdate implements JsonSerializable tags; + /* + * The data controller's properties + */ + private DataControllerProperties properties; + /** * Creates an instance of DataControllerUpdate class. */ @@ -49,11 +54,23 @@ public DataControllerUpdate withTags(Map tags) { } /** - * Validates the instance. + * Get the properties property: The data controller's properties. + * + * @return the properties value. + */ + public DataControllerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The data controller's properties. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @param properties the properties value to set. + * @return the DataControllerUpdate object itself. */ - public void validate() { + public DataControllerUpdate withProperties(DataControllerProperties properties) { + this.properties = properties; + return this; } /** @@ -63,6 +80,7 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); return jsonWriter.writeEndObject(); } @@ -84,6 +102,8 @@ public static DataControllerUpdate fromJson(JsonReader jsonReader) throws IOExce if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedDataControllerUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedDataControllerUpdate.properties = DataControllerProperties.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java index baf07879996e..8465312db923 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -13,96 +13,96 @@ */ public interface DataControllers { /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource along with {@link Response}. */ - PagedIterable list(); + Response getByResourceGroupWithResponse(String resourceGroupName, String dataControllerName, + Context context); /** - * List dataController resources in the subscription. + * Retrieves a dataController resource. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. + * @return data controller resource. */ - PagedIterable list(Context context); + DataControllerResource getByResourceGroup(String resourceGroupName, String dataControllerName); /** - * List dataController resources in the resource group. + * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. */ - PagedIterable listByResourceGroup(String resourceGroupName); + void deleteByResourceGroup(String resourceGroupName, String dataControllerName); /** - * List dataController resources in the resource group. + * Deletes a dataController resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataControllerName The name of the data controller. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + void delete(String resourceGroupName, String dataControllerName, Context context); /** - * Deletes a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - void deleteByResourceGroup(String resourceGroupName, String dataControllerName); + PagedIterable listByResourceGroup(String resourceGroupName); /** - * Deletes a dataController resource. + * List dataController resources in the resource group. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - void delete(String resourceGroupName, String dataControllerName, Context context); + PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Retrieves a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource along with {@link Response}. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String dataControllerName, - Context context); + PagedIterable list(); /** - * Retrieves a dataController resource. + * List dataController resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param dataControllerName The dataControllerName parameter. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return data controller resource. + * @return a list of data controllers as paginated response with {@link PagedIterable}. */ - DataControllerResource getByResourceGroup(String resourceGroupName, String dataControllerName); + PagedIterable list(Context context); /** * Retrieves a dataController resource. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java new file mode 100644 index 000000000000..de95e4873f47 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DatabaseAssessmentsItem model. + */ +@Immutable +public final class DatabaseAssessmentsItem implements JsonSerializable { + /* + * The appliesToMigrationTargetPlatform property. + */ + private String appliesToMigrationTargetPlatform; + + /* + * The featureId property. + */ + private String featureId; + + /* + * The issueCategory property. + */ + private String issueCategory; + + /* + * The moreInformation property. + */ + private String moreInformation; + + /** + * Creates an instance of DatabaseAssessmentsItem class. + */ + private DatabaseAssessmentsItem() { + } + + /** + * Get the appliesToMigrationTargetPlatform property: The appliesToMigrationTargetPlatform property. + * + * @return the appliesToMigrationTargetPlatform value. + */ + public String appliesToMigrationTargetPlatform() { + return this.appliesToMigrationTargetPlatform; + } + + /** + * Get the featureId property: The featureId property. + * + * @return the featureId value. + */ + public String featureId() { + return this.featureId; + } + + /** + * Get the issueCategory property: The issueCategory property. + * + * @return the issueCategory value. + */ + public String issueCategory() { + return this.issueCategory; + } + + /** + * Get the moreInformation property: The moreInformation property. + * + * @return the moreInformation value. + */ + public String moreInformation() { + return this.moreInformation; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("appliesToMigrationTargetPlatform", this.appliesToMigrationTargetPlatform); + jsonWriter.writeStringField("featureId", this.featureId); + jsonWriter.writeStringField("issueCategory", this.issueCategory); + jsonWriter.writeStringField("moreInformation", this.moreInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseAssessmentsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseAssessmentsItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseAssessmentsItem. + */ + public static DatabaseAssessmentsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseAssessmentsItem deserializedDatabaseAssessmentsItem = new DatabaseAssessmentsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("appliesToMigrationTargetPlatform".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.appliesToMigrationTargetPlatform = reader.getString(); + } else if ("featureId".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.featureId = reader.getString(); + } else if ("issueCategory".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.issueCategory = reader.getString(); + } else if ("moreInformation".equals(fieldName)) { + deserializedDatabaseAssessmentsItem.moreInformation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseAssessmentsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java new file mode 100644 index 000000000000..db5f27759314 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing + * database. sourceDatabaseId and restorePointInTime must be specified. + */ +public final class DatabaseCreateMode extends ExpandableStringEnum { + /** + * Default. + */ + public static final DatabaseCreateMode DEFAULT = fromString("Default"); + + /** + * PointInTimeRestore. + */ + public static final DatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates a new instance of DatabaseCreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DatabaseCreateMode() { + } + + /** + * Creates or finds a DatabaseCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseCreateMode. + */ + public static DatabaseCreateMode fromString(String name) { + return fromString(name, DatabaseCreateMode.class); + } + + /** + * Gets known DatabaseCreateMode values. + * + * @return known DatabaseCreateMode values. + */ + public static Collection values() { + return values(DatabaseCreateMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseMigrationJobsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseMigrationJobsItem.java new file mode 100644 index 000000000000..71181b55eb18 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseMigrationJobsItem.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The DatabaseMigrationJobsItem model. + */ +@Fluent +public final class DatabaseMigrationJobsItem implements JsonSerializable { + /* + * Reference identifier for tracking purposes/optional link to system initiating this migration. e.g. Arc MI link + * job id, DMS resource id. + */ + private String migrationTrackingId; + + /* + * Mode/type of migration. + */ + private MigrationMode migrationMode; + + /* + * To indicate the client from which the migration is initiated from e.g. Azure Arc, DMS-Azure Portal/PS/CLI for + * additional tracking. + */ + private InitiatedFrom initiatedFrom; + + /* + * Status of the migration job. + */ + private MigrationStatus status; + + /* + * Last error if any associated with this migration job. + */ + private String lastError; + + /* + * Type of target in Azure this database is being migrated to. + */ + private TargetType targetType; + + /* + * Resource Id of the target SQL resource for this migration job. + */ + private String targetResourceId; + + /* + * Time when migration job was started. + */ + private OffsetDateTime startTime; + + /* + * Time when migration job reached terminal state. + */ + private OffsetDateTime endTime; + + /* + * The additionalAttributes property. + */ + private List additionalAttributes; + + /** + * Creates an instance of DatabaseMigrationJobsItem class. + */ + public DatabaseMigrationJobsItem() { + } + + /** + * Get the migrationTrackingId property: Reference identifier for tracking purposes/optional link to system + * initiating this migration. e.g. Arc MI link job id, DMS resource id. + * + * @return the migrationTrackingId value. + */ + public String migrationTrackingId() { + return this.migrationTrackingId; + } + + /** + * Set the migrationTrackingId property: Reference identifier for tracking purposes/optional link to system + * initiating this migration. e.g. Arc MI link job id, DMS resource id. + * + * @param migrationTrackingId the migrationTrackingId value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withMigrationTrackingId(String migrationTrackingId) { + this.migrationTrackingId = migrationTrackingId; + return this; + } + + /** + * Get the migrationMode property: Mode/type of migration. + * + * @return the migrationMode value. + */ + public MigrationMode migrationMode() { + return this.migrationMode; + } + + /** + * Set the migrationMode property: Mode/type of migration. + * + * @param migrationMode the migrationMode value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withMigrationMode(MigrationMode migrationMode) { + this.migrationMode = migrationMode; + return this; + } + + /** + * Get the initiatedFrom property: To indicate the client from which the migration is initiated from e.g. Azure Arc, + * DMS-Azure Portal/PS/CLI for additional tracking. + * + * @return the initiatedFrom value. + */ + public InitiatedFrom initiatedFrom() { + return this.initiatedFrom; + } + + /** + * Set the initiatedFrom property: To indicate the client from which the migration is initiated from e.g. Azure Arc, + * DMS-Azure Portal/PS/CLI for additional tracking. + * + * @param initiatedFrom the initiatedFrom value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withInitiatedFrom(InitiatedFrom initiatedFrom) { + this.initiatedFrom = initiatedFrom; + return this; + } + + /** + * Get the status property: Status of the migration job. + * + * @return the status value. + */ + public MigrationStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the migration job. + * + * @param status the status value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withStatus(MigrationStatus status) { + this.status = status; + return this; + } + + /** + * Get the lastError property: Last error if any associated with this migration job. + * + * @return the lastError value. + */ + public String lastError() { + return this.lastError; + } + + /** + * Set the lastError property: Last error if any associated with this migration job. + * + * @param lastError the lastError value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withLastError(String lastError) { + this.lastError = lastError; + return this; + } + + /** + * Get the targetType property: Type of target in Azure this database is being migrated to. + * + * @return the targetType value. + */ + public TargetType targetType() { + return this.targetType; + } + + /** + * Set the targetType property: Type of target in Azure this database is being migrated to. + * + * @param targetType the targetType value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withTargetType(TargetType targetType) { + this.targetType = targetType; + return this; + } + + /** + * Get the targetResourceId property: Resource Id of the target SQL resource for this migration job. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: Resource Id of the target SQL resource for this migration job. + * + * @param targetResourceId the targetResourceId value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Get the startTime property: Time when migration job was started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Time when migration job was started. + * + * @param startTime the startTime value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Time when migration job reached terminal state. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Time when migration job reached terminal state. + * + * @param endTime the endTime value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the additionalAttributes property: The additionalAttributes property. + * + * @return the additionalAttributes value. + */ + public List additionalAttributes() { + return this.additionalAttributes; + } + + /** + * Set the additionalAttributes property: The additionalAttributes property. + * + * @param additionalAttributes the additionalAttributes value to set. + * @return the DatabaseMigrationJobsItem object itself. + */ + public DatabaseMigrationJobsItem + withAdditionalAttributes(List additionalAttributes) { + this.additionalAttributes = additionalAttributes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("migrationTrackingId", this.migrationTrackingId); + jsonWriter.writeStringField("migrationMode", this.migrationMode == null ? null : this.migrationMode.toString()); + jsonWriter.writeStringField("initiatedFrom", this.initiatedFrom == null ? null : this.initiatedFrom.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("lastError", this.lastError); + jsonWriter.writeStringField("targetType", this.targetType == null ? null : this.targetType.toString()); + jsonWriter.writeStringField("targetResourceId", this.targetResourceId); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeArrayField("additionalAttributes", this.additionalAttributes, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseMigrationJobsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseMigrationJobsItem if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseMigrationJobsItem. + */ + public static DatabaseMigrationJobsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseMigrationJobsItem deserializedDatabaseMigrationJobsItem = new DatabaseMigrationJobsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("migrationTrackingId".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.migrationTrackingId = reader.getString(); + } else if ("migrationMode".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.migrationMode = MigrationMode.fromString(reader.getString()); + } else if ("initiatedFrom".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.initiatedFrom = InitiatedFrom.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.status = MigrationStatus.fromString(reader.getString()); + } else if ("lastError".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.lastError = reader.getString(); + } else if ("targetType".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.targetType = TargetType.fromString(reader.getString()); + } else if ("targetResourceId".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.targetResourceId = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedDatabaseMigrationJobsItem.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("additionalAttributes".equals(fieldName)) { + List additionalAttributes + = reader.readArray(reader1 -> AdditionalMigrationJobAttributes.fromJson(reader1)); + deserializedDatabaseMigrationJobsItem.additionalAttributes = additionalAttributes; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseMigrationJobsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java new file mode 100644 index 000000000000..290e8a5216b5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of the database. + */ +public final class DatabaseState extends ExpandableStringEnum { + /** + * Online. + */ + public static final DatabaseState ONLINE = fromString("Online"); + + /** + * Restoring. + */ + public static final DatabaseState RESTORING = fromString("Restoring"); + + /** + * Recovering. + */ + public static final DatabaseState RECOVERING = fromString("Recovering"); + + /** + * RecoveryPending. + */ + public static final DatabaseState RECOVERY_PENDING = fromString("RecoveryPending"); + + /** + * Suspect. + */ + public static final DatabaseState SUSPECT = fromString("Suspect"); + + /** + * Emergency. + */ + public static final DatabaseState EMERGENCY = fromString("Emergency"); + + /** + * Offline. + */ + public static final DatabaseState OFFLINE = fromString("Offline"); + + /** + * Copying. + */ + public static final DatabaseState COPYING = fromString("Copying"); + + /** + * OfflineSecondary. + */ + public static final DatabaseState OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** + * Creates a new instance of DatabaseState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DatabaseState() { + } + + /** + * Creates or finds a DatabaseState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseState. + */ + public static DatabaseState fromString(String name) { + return fromString(name, DatabaseState.class); + } + + /** + * Gets known DatabaseState values. + * + * @return known DatabaseState values. + */ + public static Collection values() { + return values(DatabaseState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java new file mode 100644 index 000000000000..d4d9c13b0cb3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * List of database names. + */ +@Fluent +public final class Databases implements JsonSerializable { + /* + * List of database names. + */ + private List values; + + /** + * Creates an instance of Databases class. + */ + public Databases() { + } + + /** + * Get the values property: List of database names. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: List of database names. + * + * @param values the values value to set. + * @return the Databases object itself. + */ + public Databases withValues(List values) { + this.values = values; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Databases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Databases if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Databases. + */ + public static Databases fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Databases deserializedDatabases = new Databases(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> reader1.getString()); + deserializedDatabases.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabases; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java new file mode 100644 index 000000000000..8525f95000a7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Specifies whether the availability group supports failover for database health conditions. + */ +public enum DbFailover { + /** + * ON. + */ + ON("ON"), + + /** + * OFF. + */ + OFF("OFF"); + + /** + * The actual serialized value for a DbFailover instance. + */ + private final String value; + + DbFailover(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DbFailover instance. + * + * @param value the serialized value to parse. + * @return the parsed DbFailover object, or null if unable to parse. + */ + public static DbFailover fromString(String value) { + if (value == null) { + return null; + } + DbFailover[] items = DbFailover.values(); + for (DbFailover item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java index d7f91af26969..c3bc43af2626 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -12,17 +12,17 @@ */ public final class DefenderStatus extends ExpandableStringEnum { /** - * Static value Protected for DefenderStatus. + * Protected. */ public static final DefenderStatus PROTECTED = fromString("Protected"); /** - * Static value Unprotected for DefenderStatus. + * Unprotected. */ public static final DefenderStatus UNPROTECTED = fromString("Unprotected"); /** - * Static value Unknown for DefenderStatus. + * Unknown. */ public static final DefenderStatus UNKNOWN = fromString("Unknown"); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.java new file mode 100644 index 000000000000..ce89ca7e456f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * The differential backup interval in hours. + */ +public enum DifferentialBackupHours { + /** + * 12. + */ + TWELVE(12), + + /** + * 24. + */ + TWENTY_FOUR(24); + + /** + * The actual serialized value for a DifferentialBackupHours instance. + */ + private final int value; + + DifferentialBackupHours(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a DifferentialBackupHours instance. + * + * @param value the serialized value to parse. + * @return the parsed DifferentialBackupHours object, or null if unable to parse. + */ + public static DifferentialBackupHours fromInt(int value) { + DifferentialBackupHours[] items = DifferentialBackupHours.values(); + for (DifferentialBackupHours item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DiscoverySource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DiscoverySource.java new file mode 100644 index 000000000000..6b8606c8d859 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DiscoverySource.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates the discovery agent or client for this instance. + */ +public final class DiscoverySource extends ExpandableStringEnum { + /** + * Instance is discovered by Azure Arc enabled agent/extensions. + */ + public static final DiscoverySource AZURE_ARC = fromString("Azure Arc"); + + /** + * Instance is discovered by Azure Migrate agent. + */ + public static final DiscoverySource AZURE_MIGRATE = fromString("Azure Migrate"); + + /** + * Instance is discovered/registered from Azure Data Studio (ADS). + */ + public static final DiscoverySource ADS = fromString("ADS"); + + /** + * Instance is discovered/registered from SQL Server Management Studio (SSMS). + */ + public static final DiscoverySource SSMS = fromString("SSMS"); + + /** + * Instance is discovered/registered from SQL Server Migration Assistant (SSMA). + */ + public static final DiscoverySource SSMA = fromString("SSMA"); + + /** + * Instance is registered via Import. + */ + public static final DiscoverySource IMPORT = fromString("Import"); + + /** + * Instance is discovered/registered from Azure Database Migration Service(DMS) Azure Portal. + */ + public static final DiscoverySource DMSPORTAL = fromString("DMS-Portal"); + + /** + * Instance is discovered/registered from DMS using PowerShell - Azure DataMigration Service Module. + */ + public static final DiscoverySource DMSPS = fromString("DMS-PS"); + + /** + * Instance is discovered/registered from DMS using datamigration extension for the Azure CLI. + */ + public static final DiscoverySource DMSCLI = fromString("DMS-CLI"); + + /** + * Instance is discovered/registered from Azure Database Migration Service SDK like Python or .NET SDKs. + */ + public static final DiscoverySource DMSSDK = fromString("DMS-SDK"); + + /** + * Instance is discovered/registered from any other source not listed above. + */ + public static final DiscoverySource OTHER = fromString("Other"); + + /** + * Creates a new instance of DiscoverySource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiscoverySource() { + } + + /** + * Creates or finds a DiscoverySource from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiscoverySource. + */ + public static DiscoverySource fromString(String name) { + return fromString(name, DiscoverySource.class); + } + + /** + * Gets known DiscoverySource values. + * + * @return known DiscoverySource values. + */ + public static Collection values() { + return values(DiscoverySource.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DiskSizes.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DiskSizes.java new file mode 100644 index 000000000000..0ef133c91215 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DiskSizes.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * disk size values. + */ +@Immutable +public final class DiskSizes implements JsonSerializable { + /* + * Type of managed disk. + */ + private String diskType; + + /* + * Redundancy option. + */ + private String redundancy; + + /* + * Size of the managed disk - e.g. P30, P40. + */ + private String size; + + /* + * Caching configuration - e.g. read only caching + */ + private String caching; + + /* + * maximum disk size in GiB. + */ + private Double maxSizeInGib; + + /* + * maximum throughput in MB/s. + */ + private Double maxThroughputInMbps; + + /* + * maximum IO requirements/s (IOPS). + */ + private Double maxIops; + + /** + * Creates an instance of DiskSizes class. + */ + private DiskSizes() { + } + + /** + * Get the diskType property: Type of managed disk. + * + * @return the diskType value. + */ + public String diskType() { + return this.diskType; + } + + /** + * Get the redundancy property: Redundancy option. + * + * @return the redundancy value. + */ + public String redundancy() { + return this.redundancy; + } + + /** + * Get the size property: Size of the managed disk - e.g. P30, P40. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Get the caching property: Caching configuration - e.g. read only caching. + * + * @return the caching value. + */ + public String caching() { + return this.caching; + } + + /** + * Get the maxSizeInGib property: maximum disk size in GiB. + * + * @return the maxSizeInGib value. + */ + public Double maxSizeInGib() { + return this.maxSizeInGib; + } + + /** + * Get the maxThroughputInMbps property: maximum throughput in MB/s. + * + * @return the maxThroughputInMbps value. + */ + public Double maxThroughputInMbps() { + return this.maxThroughputInMbps; + } + + /** + * Get the maxIops property: maximum IO requirements/s (IOPS). + * + * @return the maxIops value. + */ + public Double maxIops() { + return this.maxIops; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("diskType", this.diskType); + jsonWriter.writeStringField("redundancy", this.redundancy); + jsonWriter.writeStringField("size", this.size); + jsonWriter.writeStringField("caching", this.caching); + jsonWriter.writeNumberField("maxSizeInGib", this.maxSizeInGib); + jsonWriter.writeNumberField("maxThroughputInMbps", this.maxThroughputInMbps); + jsonWriter.writeNumberField("maxIops", this.maxIops); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskSizes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskSizes if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the DiskSizes. + */ + public static DiskSizes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskSizes deserializedDiskSizes = new DiskSizes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("diskType".equals(fieldName)) { + deserializedDiskSizes.diskType = reader.getString(); + } else if ("redundancy".equals(fieldName)) { + deserializedDiskSizes.redundancy = reader.getString(); + } else if ("size".equals(fieldName)) { + deserializedDiskSizes.size = reader.getString(); + } else if ("caching".equals(fieldName)) { + deserializedDiskSizes.caching = reader.getString(); + } else if ("maxSizeInGib".equals(fieldName)) { + deserializedDiskSizes.maxSizeInGib = reader.getNullable(JsonReader::getDouble); + } else if ("maxThroughputInMbps".equals(fieldName)) { + deserializedDiskSizes.maxThroughputInMbps = reader.getNullable(JsonReader::getDouble); + } else if ("maxIops".equals(fieldName)) { + deserializedDiskSizes.maxIops = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskSizes; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java new file mode 100644 index 000000000000..1270a88a50df --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The availability group certificate configuration. + */ +@Fluent +public final class DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + implements JsonSerializable { + /* + * Name of the certificate. + */ + private String certificateName; + + /** + * Creates an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration class. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() { + } + + /** + * Get the certificateName property: Name of the certificate. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Set the certificateName property: Name of the certificate. + * + * @param certificateName the certificateName value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + withCertificateName(String certificateName) { + this.certificateName = certificateName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("certificateName", this.certificateName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration from the + * JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration if the + * JsonReader was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration. + */ + public static DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + = new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("certificateName".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.certificateName + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java new file mode 100644 index 000000000000..e416ae84c27b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The availability group configuration specification for a distributed availability group. + */ +@Fluent +public final class DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + implements JsonSerializable { + /* + * The azure resource identifier for the availability group. + */ + private String availabilityGroup; + + /* + * The listener URL of the availability group. + */ + private String listenerUrl; + + /* + * The availability mode of the availability group. + */ + private ArcSqlServerAvailabilityMode availabilityMode; + + /* + * The failover mode of the availability group. + */ + private ArcSqlServerFailoverMode failoverMode; + + /* + * The seeding mode of the availability group. + */ + private SeedingMode seedingMode; + + /* + * The certificate configuration for the availability group. + */ + private DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration certificateConfiguration; + + /** + * Creates an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration class. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() { + } + + /** + * Get the availabilityGroup property: The azure resource identifier for the availability group. + * + * @return the availabilityGroup value. + */ + public String availabilityGroup() { + return this.availabilityGroup; + } + + /** + * Set the availabilityGroup property: The azure resource identifier for the availability group. + * + * @param availabilityGroup the availabilityGroup value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withAvailabilityGroup(String availabilityGroup) { + this.availabilityGroup = availabilityGroup; + return this; + } + + /** + * Get the listenerUrl property: The listener URL of the availability group. + * + * @return the listenerUrl value. + */ + public String listenerUrl() { + return this.listenerUrl; + } + + /** + * Set the listenerUrl property: The listener URL of the availability group. + * + * @param listenerUrl the listenerUrl value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration withListenerUrl(String listenerUrl) { + this.listenerUrl = listenerUrl; + return this; + } + + /** + * Get the availabilityMode property: The availability mode of the availability group. + * + * @return the availabilityMode value. + */ + public ArcSqlServerAvailabilityMode availabilityMode() { + return this.availabilityMode; + } + + /** + * Set the availabilityMode property: The availability mode of the availability group. + * + * @param availabilityMode the availabilityMode value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withAvailabilityMode(ArcSqlServerAvailabilityMode availabilityMode) { + this.availabilityMode = availabilityMode; + return this; + } + + /** + * Get the failoverMode property: The failover mode of the availability group. + * + * @return the failoverMode value. + */ + public ArcSqlServerFailoverMode failoverMode() { + return this.failoverMode; + } + + /** + * Set the failoverMode property: The failover mode of the availability group. + * + * @param failoverMode the failoverMode value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withFailoverMode(ArcSqlServerFailoverMode failoverMode) { + this.failoverMode = failoverMode; + return this; + } + + /** + * Get the seedingMode property: The seeding mode of the availability group. + * + * @return the seedingMode value. + */ + public SeedingMode seedingMode() { + return this.seedingMode; + } + + /** + * Set the seedingMode property: The seeding mode of the availability group. + * + * @param seedingMode the seedingMode value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + withSeedingMode(SeedingMode seedingMode) { + this.seedingMode = seedingMode; + return this; + } + + /** + * Get the certificateConfiguration property: The certificate configuration for the availability group. + * + * @return the certificateConfiguration value. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + certificateConfiguration() { + return this.certificateConfiguration; + } + + /** + * Set the certificateConfiguration property: The certificate configuration for the availability group. + * + * @param certificateConfiguration the certificateConfiguration value to set. + * @return the DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration withCertificateConfiguration( + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration certificateConfiguration) { + this.certificateConfiguration = certificateConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroup", this.availabilityGroup); + jsonWriter.writeStringField("listenerUrl", this.listenerUrl); + jsonWriter.writeStringField("availabilityMode", + this.availabilityMode == null ? null : this.availabilityMode.toString()); + jsonWriter.writeStringField("failoverMode", this.failoverMode == null ? null : this.failoverMode.toString()); + jsonWriter.writeStringField("seedingMode", this.seedingMode == null ? null : this.seedingMode.toString()); + jsonWriter.writeJsonField("certificateConfiguration", this.certificateConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration if the JsonReader + * was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration. + */ + public static DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration + = new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroup".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.availabilityGroup + = reader.getString(); + } else if ("listenerUrl".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.listenerUrl + = reader.getString(); + } else if ("availabilityMode".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.availabilityMode + = ArcSqlServerAvailabilityMode.fromString(reader.getString()); + } else if ("failoverMode".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.failoverMode + = ArcSqlServerFailoverMode.fromString(reader.getString()); + } else if ("seedingMode".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.seedingMode + = SeedingMode.fromString(reader.getString()); + } else if ("certificateConfiguration".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.certificateConfiguration + = DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration + .fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java new file mode 100644 index 000000000000..d98a2b3261c3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Options used in creating a distributed availability group. + */ +@Fluent +public final class DistributedAvailabilityGroupCreateUpdateConfiguration + implements JsonSerializable { + /* + * Name of the availability group. + */ + private String availabilityGroupName; + + /* + * The initial primary availability group for the distributed availability group. + */ + private DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration primaryAvailabilityGroup; + + /* + * The initial secondary availability group for the distributed availability group. + */ + private DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration secondaryAvailabilityGroup; + + /** + * Creates an instance of DistributedAvailabilityGroupCreateUpdateConfiguration class. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration() { + } + + /** + * Get the availabilityGroupName property: Name of the availability group. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: Name of the availability group. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the DistributedAvailabilityGroupCreateUpdateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration + withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the primaryAvailabilityGroup property: The initial primary availability group for the distributed + * availability group. + * + * @return the primaryAvailabilityGroup value. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration primaryAvailabilityGroup() { + return this.primaryAvailabilityGroup; + } + + /** + * Set the primaryAvailabilityGroup property: The initial primary availability group for the distributed + * availability group. + * + * @param primaryAvailabilityGroup the primaryAvailabilityGroup value to set. + * @return the DistributedAvailabilityGroupCreateUpdateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration withPrimaryAvailabilityGroup( + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration primaryAvailabilityGroup) { + this.primaryAvailabilityGroup = primaryAvailabilityGroup; + return this; + } + + /** + * Get the secondaryAvailabilityGroup property: The initial secondary availability group for the distributed + * availability group. + * + * @return the secondaryAvailabilityGroup value. + */ + public DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration secondaryAvailabilityGroup() { + return this.secondaryAvailabilityGroup; + } + + /** + * Set the secondaryAvailabilityGroup property: The initial secondary availability group for the distributed + * availability group. + * + * @param secondaryAvailabilityGroup the secondaryAvailabilityGroup value to set. + * @return the DistributedAvailabilityGroupCreateUpdateConfiguration object itself. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration withSecondaryAvailabilityGroup( + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration secondaryAvailabilityGroup) { + this.secondaryAvailabilityGroup = secondaryAvailabilityGroup; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("availabilityGroupName", this.availabilityGroupName); + jsonWriter.writeJsonField("primaryAvailabilityGroup", this.primaryAvailabilityGroup); + jsonWriter.writeJsonField("secondaryAvailabilityGroup", this.secondaryAvailabilityGroup); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DistributedAvailabilityGroupCreateUpdateConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DistributedAvailabilityGroupCreateUpdateConfiguration if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DistributedAvailabilityGroupCreateUpdateConfiguration. + */ + public static DistributedAvailabilityGroupCreateUpdateConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DistributedAvailabilityGroupCreateUpdateConfiguration deserializedDistributedAvailabilityGroupCreateUpdateConfiguration + = new DistributedAvailabilityGroupCreateUpdateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupName".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateConfiguration.availabilityGroupName + = reader.getString(); + } else if ("primaryAvailabilityGroup".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateConfiguration.primaryAvailabilityGroup + = DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.fromJson(reader); + } else if ("secondaryAvailabilityGroup".equals(fieldName)) { + deserializedDistributedAvailabilityGroupCreateUpdateConfiguration.secondaryAvailabilityGroup + = DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDistributedAvailabilityGroupCreateUpdateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java new file mode 100644 index 000000000000..1bc2c03d9d7f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Specifies whether DTC support has been enabled for this availability group. + */ +public enum DtcSupport { + /** + * PER_DB. + */ + PERDB("PER_DB"), + + /** + * NONE. + */ + NONE("NONE"); + + /** + * The actual serialized value for a DtcSupport instance. + */ + private final String value; + + DtcSupport(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DtcSupport instance. + * + * @param value the serialized value to parse. + * @return the parsed DtcSupport object, or null if unable to parse. + */ + public static DtcSupport fromString(String value) { + if (value == null) { + return null; + } + DtcSupport[] items = DtcSupport.values(); + for (DtcSupport item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java index 9b0111c001fd..41ad1220b3f3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -12,35 +12,50 @@ */ public final class EditionType extends ExpandableStringEnum { /** - * Static value Evaluation for EditionType. + * Evaluation. */ public static final EditionType EVALUATION = fromString("Evaluation"); /** - * Static value Enterprise for EditionType. + * Enterprise. */ public static final EditionType ENTERPRISE = fromString("Enterprise"); /** - * Static value Standard for EditionType. + * Standard. */ public static final EditionType STANDARD = fromString("Standard"); /** - * Static value Web for EditionType. + * Web. */ public static final EditionType WEB = fromString("Web"); /** - * Static value Developer for EditionType. + * Developer. */ public static final EditionType DEVELOPER = fromString("Developer"); /** - * Static value Express for EditionType. + * Express. */ public static final EditionType EXPRESS = fromString("Express"); + /** + * Business Intelligence. + */ + public static final EditionType BUSINESS_INTELLIGENCE = fromString("Business Intelligence"); + + /** + * Standard Developer. + */ + public static final EditionType STANDARD_DEVELOPER = fromString("Standard Developer"); + + /** + * Unknown. + */ + public static final EditionType UNKNOWN = fromString("Unknown"); + /** * Creates a new instance of EditionType value. * diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java new file mode 100644 index 000000000000..f39c0a5894a0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The encryption algorithm(s) used by the endpoint. + */ +public final class EncryptionAlgorithm extends ExpandableStringEnum { + /** + * NONE. + */ + public static final EncryptionAlgorithm NONE = fromString("NONE"); + + /** + * RC4. + */ + public static final EncryptionAlgorithm RC4 = fromString("RC4"); + + /** + * AES. + */ + public static final EncryptionAlgorithm AES = fromString("AES"); + + /** + * NONE, RC4. + */ + public static final EncryptionAlgorithm NONE_RC4 = fromString("NONE, RC4"); + + /** + * NONE, AES. + */ + public static final EncryptionAlgorithm NONE_AES = fromString("NONE, AES"); + + /** + * RC4, AES. + */ + public static final EncryptionAlgorithm RC4AES = fromString("RC4, AES"); + + /** + * AES, RC4. + */ + public static final EncryptionAlgorithm AESRC4 = fromString("AES, RC4"); + + /** + * NONE, RC4, AES. + */ + public static final EncryptionAlgorithm NONE_RC4AES = fromString("NONE, RC4, AES"); + + /** + * NONE, AES, RC4. + */ + public static final EncryptionAlgorithm NONE_AESRC4 = fromString("NONE, AES, RC4"); + + /** + * Creates a new instance of EncryptionAlgorithm value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EncryptionAlgorithm() { + } + + /** + * Creates or finds a EncryptionAlgorithm from its string representation. + * + * @param name a name to look for. + * @return the corresponding EncryptionAlgorithm. + */ + public static EncryptionAlgorithm fromString(String name) { + return fromString(name, EncryptionAlgorithm.class); + } + + /** + * Gets known EncryptionAlgorithm values. + * + * @return known EncryptionAlgorithm values. + */ + public static Collection values() { + return values(EncryptionAlgorithm.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EntraAuthentication.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EntraAuthentication.java new file mode 100644 index 000000000000..da35b5db336f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/EntraAuthentication.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Entra Authentication configuration. + */ +@Fluent +public final class EntraAuthentication implements JsonSerializable { + /* + * The method used for Entra authentication + */ + private IdentityType identityType; + + /* + * The client Id of the Managed Identity to query Microsoft Graph API. An empty string must be used for the system + * assigned Managed Identity. + */ + private String clientId; + + /** + * Creates an instance of EntraAuthentication class. + */ + public EntraAuthentication() { + } + + /** + * Get the identityType property: The method used for Entra authentication. + * + * @return the identityType value. + */ + public IdentityType identityType() { + return this.identityType; + } + + /** + * Set the identityType property: The method used for Entra authentication. + * + * @param identityType the identityType value to set. + * @return the EntraAuthentication object itself. + */ + public EntraAuthentication withIdentityType(IdentityType identityType) { + this.identityType = identityType; + return this; + } + + /** + * Get the clientId property: The client Id of the Managed Identity to query Microsoft Graph API. An empty string + * must be used for the system assigned Managed Identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The client Id of the Managed Identity to query Microsoft Graph API. An empty string + * must be used for the system assigned Managed Identity. + * + * @param clientId the clientId value to set. + * @return the EntraAuthentication object itself. + */ + public EntraAuthentication withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identityType", this.identityType == null ? null : this.identityType.toString()); + jsonWriter.writeStringField("clientId", this.clientId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EntraAuthentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EntraAuthentication if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EntraAuthentication. + */ + public static EntraAuthentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EntraAuthentication deserializedEntraAuthentication = new EntraAuthentication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identityType".equals(fieldName)) { + deserializedEntraAuthentication.identityType = IdentityType.fromString(reader.getString()); + } else if ("clientId".equals(fieldName)) { + deserializedEntraAuthentication.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEntraAuthentication; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.java new file mode 100644 index 000000000000..326241af2034 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The execution state of the background job. + */ +public final class ExecutionState extends ExpandableStringEnum { + /** + * Waiting. + */ + public static final ExecutionState WAITING = fromString("Waiting"); + + /** + * Running. + */ + public static final ExecutionState RUNNING = fromString("Running"); + + /** + * Creates a new instance of ExecutionState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExecutionState() { + } + + /** + * Creates or finds a ExecutionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExecutionState. + */ + public static ExecutionState fromString(String name) { + return fromString(name, ExecutionState.class); + } + + /** + * Gets known ExecutionState values. + * + * @return known ExecutionState values. + */ + public static Collection values() { + return values(ExecutionState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java index 42efd9ebe39f..05490f8859d5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -72,14 +72,6 @@ public ExtendedLocation withType(ExtendedLocationTypes type) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java index 40dd7f500d72..f337d3b37f20 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -12,7 +12,7 @@ */ public final class ExtendedLocationTypes extends ExpandableStringEnum { /** - * Static value CustomLocation for ExtendedLocationTypes. + * CustomLocation. */ public static final ExtendedLocationTypes CUSTOM_LOCATION = fromString("CustomLocation"); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.java new file mode 100644 index 000000000000..0090aa3bf970 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Failover Cluster Instance properties. + */ +@Immutable +public final class FailoverCluster implements JsonSerializable { + /* + * The GUID of the SQL Server's underlying Failover Cluster. + */ + private String id; + + /* + * The network name to connect to the SQL FCI. + */ + private String networkName; + + /* + * The ARM IDs of the Arc SQL Server resources, belonging to the current server's Failover cluster. + */ + private List sqlInstanceIds; + + /* + * The host names which are part of the SQL FCI resource group. + */ + private List hostNames; + + /* + * The IP addresses and subnet masks associated with the SQL Failover Cluster Instance on this host. + */ + private List hostIPAddresses; + + /** + * Creates an instance of FailoverCluster class. + */ + public FailoverCluster() { + } + + /** + * Get the id property: The GUID of the SQL Server's underlying Failover Cluster. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the networkName property: The network name to connect to the SQL FCI. + * + * @return the networkName value. + */ + public String networkName() { + return this.networkName; + } + + /** + * Get the sqlInstanceIds property: The ARM IDs of the Arc SQL Server resources, belonging to the current server's + * Failover cluster. + * + * @return the sqlInstanceIds value. + */ + public List sqlInstanceIds() { + return this.sqlInstanceIds; + } + + /** + * Get the hostNames property: The host names which are part of the SQL FCI resource group. + * + * @return the hostNames value. + */ + public List hostNames() { + return this.hostNames; + } + + /** + * Get the hostIPAddresses property: The IP addresses and subnet masks associated with the SQL Failover Cluster + * Instance on this host. + * + * @return the hostIPAddresses value. + */ + public List hostIPAddresses() { + return this.hostIPAddresses; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverCluster from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverCluster if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the FailoverCluster. + */ + public static FailoverCluster fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverCluster deserializedFailoverCluster = new FailoverCluster(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFailoverCluster.id = reader.getString(); + } else if ("networkName".equals(fieldName)) { + deserializedFailoverCluster.networkName = reader.getString(); + } else if ("sqlInstanceIds".equals(fieldName)) { + List sqlInstanceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedFailoverCluster.sqlInstanceIds = sqlInstanceIds; + } else if ("hostNames".equals(fieldName)) { + List hostNames = reader.readArray(reader1 -> reader1.getString()); + deserializedFailoverCluster.hostNames = hostNames; + } else if ("hostIPAddresses".equals(fieldName)) { + List hostIPAddresses + = reader.readArray(reader1 -> HostIPAddressInformation.fromJson(reader1)); + deserializedFailoverCluster.hostIPAddresses = hostIPAddresses; + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverCluster; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java new file mode 100644 index 000000000000..0d39d135a22c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The partner sync mode of the SQL managed instance. + */ +public final class FailoverGroupPartnerSyncMode extends ExpandableStringEnum { + /** + * async. + */ + public static final FailoverGroupPartnerSyncMode ASYNC = fromString("async"); + + /** + * sync. + */ + public static final FailoverGroupPartnerSyncMode SYNC = fromString("sync"); + + /** + * Creates a new instance of FailoverGroupPartnerSyncMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FailoverGroupPartnerSyncMode() { + } + + /** + * Creates or finds a FailoverGroupPartnerSyncMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding FailoverGroupPartnerSyncMode. + */ + public static FailoverGroupPartnerSyncMode fromString(String name) { + return fromString(name, FailoverGroupPartnerSyncMode.class); + } + + /** + * Gets known FailoverGroupPartnerSyncMode values. + * + * @return known FailoverGroupPartnerSyncMode values. + */ + public static Collection values() { + return values(FailoverGroupPartnerSyncMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java new file mode 100644 index 000000000000..ebbf22e2b67f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The properties of a failover group resource. + */ +@Fluent +public final class FailoverGroupProperties implements JsonSerializable { + /* + * The provisioning state of the failover group resource. + */ + private ProvisioningState provisioningState; + + /* + * The resource ID of the partner SQL managed instance. + */ + private String partnerManagedInstanceId; + + /* + * The specifications of the failover group resource. + */ + private FailoverGroupSpec spec; + + /* + * The status of the failover group custom resource. + */ + private Object status; + + /* + * The properties of a failover group resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of FailoverGroupProperties class. + */ + public FailoverGroupProperties() { + } + + /** + * Get the provisioningState property: The provisioning state of the failover group resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the partnerManagedInstanceId property: The resource ID of the partner SQL managed instance. + * + * @return the partnerManagedInstanceId value. + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set the partnerManagedInstanceId property: The resource ID of the partner SQL managed instance. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + + /** + * Get the spec property: The specifications of the failover group resource. + * + * @return the spec value. + */ + public FailoverGroupSpec spec() { + return this.spec; + } + + /** + * Set the spec property: The specifications of the failover group resource. + * + * @param spec the spec value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withSpec(FailoverGroupSpec spec) { + this.spec = spec; + return this; + } + + /** + * Get the status property: The status of the failover group custom resource. + * + * @return the status value. + */ + public Object status() { + return this.status; + } + + /** + * Set the status property: The status of the failover group custom resource. + * + * @param status the status value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withStatus(Object status) { + this.status = status; + return this; + } + + /** + * Get the additionalProperties property: The properties of a failover group resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The properties of a failover group resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("partnerManagedInstanceId", this.partnerManagedInstanceId); + jsonWriter.writeJsonField("spec", this.spec); + if (this.status != null) { + jsonWriter.writeUntypedField("status", this.status); + } + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverGroupProperties. + */ + public static FailoverGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupProperties deserializedFailoverGroupProperties = new FailoverGroupProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("partnerManagedInstanceId".equals(fieldName)) { + deserializedFailoverGroupProperties.partnerManagedInstanceId = reader.getString(); + } else if ("spec".equals(fieldName)) { + deserializedFailoverGroupProperties.spec = FailoverGroupSpec.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedFailoverGroupProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedFailoverGroupProperties.status = reader.readUntyped(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedFailoverGroupProperties.additionalProperties = additionalProperties; + + return deserializedFailoverGroupProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java new file mode 100644 index 000000000000..a379b36605f7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; + +/** + * An immutable client-side representation of FailoverGroupResource. + */ +public interface FailoverGroupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + FailoverGroupProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner object. + * + * @return the inner object. + */ + FailoverGroupResourceInner innerModel(); + + /** + * The entirety of the FailoverGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The FailoverGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FailoverGroupResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FailoverGroupResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlManagedInstanceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlManagedInstance(String resourceGroupName, String sqlManagedInstanceName); + } + + /** + * The stage of the FailoverGroupResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(FailoverGroupProperties properties); + } + + /** + * The stage of the FailoverGroupResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + FailoverGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FailoverGroupResource create(Context context); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FailoverGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FailoverGroupResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java new file mode 100644 index 000000000000..e02126fbc6f8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The specifications of the failover group resource. + */ +@Fluent +public final class FailoverGroupSpec implements JsonSerializable { + /* + * The shared name of the failover group for this SQL managed instance. Both SQL managed instance and its partner + * have to use the same shared name. + */ + private String sharedName; + + /* + * The name of the SQL managed instance with this failover group role. + */ + private String sourceMI; + + /* + * The name of the partner SQL managed instance. + */ + private String partnerMI; + + /* + * The mirroring endpoint URL of the partner SQL managed instance. + */ + private String partnerMirroringUrl; + + /* + * The mirroring endpoint public certificate for the partner SQL managed instance. Only PEM format is supported. + */ + private String partnerMirroringCert; + + /* + * The partner sync mode of the SQL managed instance. + */ + private FailoverGroupPartnerSyncMode partnerSyncMode; + + /* + * The role of the SQL managed instance in this failover group. + */ + private InstanceFailoverGroupRole role; + + /* + * The specifications of the failover group resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of FailoverGroupSpec class. + */ + public FailoverGroupSpec() { + } + + /** + * Get the sharedName property: The shared name of the failover group for this SQL managed instance. Both SQL + * managed instance and its partner have to use the same shared name. + * + * @return the sharedName value. + */ + public String sharedName() { + return this.sharedName; + } + + /** + * Set the sharedName property: The shared name of the failover group for this SQL managed instance. Both SQL + * managed instance and its partner have to use the same shared name. + * + * @param sharedName the sharedName value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withSharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Get the sourceMI property: The name of the SQL managed instance with this failover group role. + * + * @return the sourceMI value. + */ + public String sourceMI() { + return this.sourceMI; + } + + /** + * Set the sourceMI property: The name of the SQL managed instance with this failover group role. + * + * @param sourceMI the sourceMI value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withSourceMI(String sourceMI) { + this.sourceMI = sourceMI; + return this; + } + + /** + * Get the partnerMI property: The name of the partner SQL managed instance. + * + * @return the partnerMI value. + */ + public String partnerMI() { + return this.partnerMI; + } + + /** + * Set the partnerMI property: The name of the partner SQL managed instance. + * + * @param partnerMI the partnerMI value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerMI(String partnerMI) { + this.partnerMI = partnerMI; + return this; + } + + /** + * Get the partnerMirroringUrl property: The mirroring endpoint URL of the partner SQL managed instance. + * + * @return the partnerMirroringUrl value. + */ + public String partnerMirroringUrl() { + return this.partnerMirroringUrl; + } + + /** + * Set the partnerMirroringUrl property: The mirroring endpoint URL of the partner SQL managed instance. + * + * @param partnerMirroringUrl the partnerMirroringUrl value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerMirroringUrl(String partnerMirroringUrl) { + this.partnerMirroringUrl = partnerMirroringUrl; + return this; + } + + /** + * Get the partnerMirroringCert property: The mirroring endpoint public certificate for the partner SQL managed + * instance. Only PEM format is supported. + * + * @return the partnerMirroringCert value. + */ + public String partnerMirroringCert() { + return this.partnerMirroringCert; + } + + /** + * Set the partnerMirroringCert property: The mirroring endpoint public certificate for the partner SQL managed + * instance. Only PEM format is supported. + * + * @param partnerMirroringCert the partnerMirroringCert value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerMirroringCert(String partnerMirroringCert) { + this.partnerMirroringCert = partnerMirroringCert; + return this; + } + + /** + * Get the partnerSyncMode property: The partner sync mode of the SQL managed instance. + * + * @return the partnerSyncMode value. + */ + public FailoverGroupPartnerSyncMode partnerSyncMode() { + return this.partnerSyncMode; + } + + /** + * Set the partnerSyncMode property: The partner sync mode of the SQL managed instance. + * + * @param partnerSyncMode the partnerSyncMode value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withPartnerSyncMode(FailoverGroupPartnerSyncMode partnerSyncMode) { + this.partnerSyncMode = partnerSyncMode; + return this; + } + + /** + * Get the role property: The role of the SQL managed instance in this failover group. + * + * @return the role value. + */ + public InstanceFailoverGroupRole role() { + return this.role; + } + + /** + * Set the role property: The role of the SQL managed instance in this failover group. + * + * @param role the role value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withRole(InstanceFailoverGroupRole role) { + this.role = role; + return this; + } + + /** + * Get the additionalProperties property: The specifications of the failover group resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The specifications of the failover group resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the FailoverGroupSpec object itself. + */ + public FailoverGroupSpec withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("role", this.role == null ? null : this.role.toString()); + jsonWriter.writeStringField("sharedName", this.sharedName); + jsonWriter.writeStringField("sourceMI", this.sourceMI); + jsonWriter.writeStringField("partnerMI", this.partnerMI); + jsonWriter.writeStringField("partnerMirroringURL", this.partnerMirroringUrl); + jsonWriter.writeStringField("partnerMirroringCert", this.partnerMirroringCert); + jsonWriter.writeStringField("partnerSyncMode", + this.partnerSyncMode == null ? null : this.partnerSyncMode.toString()); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverGroupSpec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverGroupSpec if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailoverGroupSpec. + */ + public static FailoverGroupSpec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverGroupSpec deserializedFailoverGroupSpec = new FailoverGroupSpec(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("role".equals(fieldName)) { + deserializedFailoverGroupSpec.role = InstanceFailoverGroupRole.fromString(reader.getString()); + } else if ("sharedName".equals(fieldName)) { + deserializedFailoverGroupSpec.sharedName = reader.getString(); + } else if ("sourceMI".equals(fieldName)) { + deserializedFailoverGroupSpec.sourceMI = reader.getString(); + } else if ("partnerMI".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerMI = reader.getString(); + } else if ("partnerMirroringURL".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerMirroringUrl = reader.getString(); + } else if ("partnerMirroringCert".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerMirroringCert = reader.getString(); + } else if ("partnerSyncMode".equals(fieldName)) { + deserializedFailoverGroupSpec.partnerSyncMode + = FailoverGroupPartnerSyncMode.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedFailoverGroupSpec.additionalProperties = additionalProperties; + + return deserializedFailoverGroupSpec; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java new file mode 100644 index 000000000000..74e520eeeb3a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of FailoverGroups. + */ +public interface FailoverGroups { + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String sqlManagedInstanceName, + String failoverGroupName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource. + */ + FailoverGroupResource get(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName); + + /** + * Deletes a failover group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param failoverGroupName The name of the Failover Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlManagedInstanceName, String failoverGroupName, Context context); + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName); + + /** + * List the failover groups associated with the given sql managed instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlManagedInstanceName, Context context); + + /** + * Retrieves a failover group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + FailoverGroupResource getById(String id); + + /** + * Retrieves a failover group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a failover group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a failover group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FailoverGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new FailoverGroupResource definition. + */ + FailoverGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverMiLinkResourceId.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverMiLinkResourceId.java new file mode 100644 index 000000000000..eb6618863a16 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverMiLinkResourceId.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The azure resource identifier for the Sql Managed Instance. + */ +@Fluent +public final class FailoverMiLinkResourceId implements JsonSerializable { + /* + * Azure resource id for the sql managed instance. + */ + private String managedInstanceId; + + /* + * Whether to perform a Force Failover as opposed to just a regular Failover. + */ + private Boolean force; + + /** + * Creates an instance of FailoverMiLinkResourceId class. + */ + public FailoverMiLinkResourceId() { + } + + /** + * Get the managedInstanceId property: Azure resource id for the sql managed instance. + * + * @return the managedInstanceId value. + */ + public String managedInstanceId() { + return this.managedInstanceId; + } + + /** + * Set the managedInstanceId property: Azure resource id for the sql managed instance. + * + * @param managedInstanceId the managedInstanceId value to set. + * @return the FailoverMiLinkResourceId object itself. + */ + public FailoverMiLinkResourceId withManagedInstanceId(String managedInstanceId) { + this.managedInstanceId = managedInstanceId; + return this; + } + + /** + * Get the force property: Whether to perform a Force Failover as opposed to just a regular Failover. + * + * @return the force value. + */ + public Boolean force() { + return this.force; + } + + /** + * Set the force property: Whether to perform a Force Failover as opposed to just a regular Failover. + * + * @param force the force value to set. + * @return the FailoverMiLinkResourceId object itself. + */ + public FailoverMiLinkResourceId withForce(Boolean force) { + this.force = force; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("managedInstanceId", this.managedInstanceId); + jsonWriter.writeBooleanField("force", this.force); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailoverMiLinkResourceId from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailoverMiLinkResourceId if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FailoverMiLinkResourceId. + */ + public static FailoverMiLinkResourceId fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailoverMiLinkResourceId deserializedFailoverMiLinkResourceId = new FailoverMiLinkResourceId(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("managedInstanceId".equals(fieldName)) { + deserializedFailoverMiLinkResourceId.managedInstanceId = reader.getString(); + } else if ("force".equals(fieldName)) { + deserializedFailoverMiLinkResourceId.force = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedFailoverMiLinkResourceId; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java new file mode 100644 index 000000000000..16a3b1832f65 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * User-defined failure condition level under which an automatic failover must be triggered. + */ +public enum FailureConditionLevel { + /** + * 1. + */ + ONE(1), + + /** + * 2. + */ + TWO(2), + + /** + * 3. + */ + THREE(3), + + /** + * 4. + */ + FOUR(4), + + /** + * 5. + */ + FIVE(5); + + /** + * The actual serialized value for a FailureConditionLevel instance. + */ + private final int value; + + FailureConditionLevel(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a FailureConditionLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed FailureConditionLevel object, or null if unable to parse. + */ + public static FailureConditionLevel fromInt(int value) { + FailureConditionLevel[] items = FailureConditionLevel.values(); + for (FailureConditionLevel item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostIPAddressInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostIPAddressInformation.java new file mode 100644 index 000000000000..358f926618a8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostIPAddressInformation.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * IP address and subnet mask. + */ +@Immutable +public final class HostIPAddressInformation implements JsonSerializable { + /* + * IP address + */ + private String ipAddress; + + /* + * Subnet mask + */ + private String subnetMask; + + /** + * Creates an instance of HostIPAddressInformation class. + */ + private HostIPAddressInformation() { + } + + /** + * Get the ipAddress property: IP address. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Get the subnetMask property: Subnet mask. + * + * @return the subnetMask value. + */ + public String subnetMask() { + return this.subnetMask; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HostIPAddressInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HostIPAddressInformation if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the HostIPAddressInformation. + */ + public static HostIPAddressInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HostIPAddressInformation deserializedHostIPAddressInformation = new HostIPAddressInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipAddress".equals(fieldName)) { + deserializedHostIPAddressInformation.ipAddress = reader.getString(); + } else if ("subnetMask".equals(fieldName)) { + deserializedHostIPAddressInformation.subnetMask = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHostIPAddressInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java new file mode 100644 index 000000000000..266cc8fa8325 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of host for Azure Arc SQL Server. + */ +public final class HostType extends ExpandableStringEnum { + /** + * Azure Virtual Machine. + */ + public static final HostType AZURE_VIRTUAL_MACHINE = fromString("Azure Virtual Machine"); + + /** + * Azure VMWare Virtual Machine. + */ + public static final HostType AZURE_VMWARE_VIRTUAL_MACHINE = fromString("Azure VMWare Virtual Machine"); + + /** + * Azure Kubernetes Service. + */ + public static final HostType AZURE_KUBERNETES_SERVICE = fromString("Azure Kubernetes Service"); + + /** + * AWS VMWare Virtual Machine. + */ + public static final HostType AWSVMWARE_VIRTUAL_MACHINE = fromString("AWS VMWare Virtual Machine"); + + /** + * AWS Kubernetes Service. + */ + public static final HostType AWSKUBERNETES_SERVICE = fromString("AWS Kubernetes Service"); + + /** + * GCP VMWare Virtual Machine. + */ + public static final HostType GCPVMWARE_VIRTUAL_MACHINE = fromString("GCP VMWare Virtual Machine"); + + /** + * GCP Kubernetes Service. + */ + public static final HostType GCPKUBERNETES_SERVICE = fromString("GCP Kubernetes Service"); + + /** + * Container. + */ + public static final HostType CONTAINER = fromString("Container"); + + /** + * Virtual Machine. + */ + public static final HostType VIRTUAL_MACHINE = fromString("Virtual Machine"); + + /** + * Physical Server. + */ + public static final HostType PHYSICAL_SERVER = fromString("Physical Server"); + + /** + * AWS Virtual Machine. + */ + public static final HostType AWSVIRTUAL_MACHINE = fromString("AWS Virtual Machine"); + + /** + * GCP Virtual Machine. + */ + public static final HostType GCPVIRTUAL_MACHINE = fromString("GCP Virtual Machine"); + + /** + * Hyper-V Virtual Machine. + */ + public static final HostType HYPER_VVIRTUAL_MACHINE = fromString("Hyper-V Virtual Machine"); + + /** + * Other. + */ + public static final HostType OTHER = fromString("Other"); + + /** + * Creates a new instance of HostType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HostType() { + } + + /** + * Creates or finds a HostType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HostType. + */ + public static HostType fromString(String name) { + return fromString(name, HostType.class); + } + + /** + * Gets known HostType values. + * + * @return known HostType values. + */ + public static Collection values() { + return values(HostType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/IdentityType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/IdentityType.java new file mode 100644 index 000000000000..2cad7397822c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/IdentityType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The method used for Entra authentication. + */ +public final class IdentityType extends ExpandableStringEnum { + /** + * System Assigned Managed Identity. + */ + public static final IdentityType SYSTEM_ASSIGNED_MANAGED_IDENTITY = fromString("SystemAssignedManagedIdentity"); + + /** + * User Assigned Managed Identity. + */ + public static final IdentityType USER_ASSIGNED_MANAGED_IDENTITY = fromString("UserAssignedManagedIdentity"); + + /** + * Creates a new instance of IdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IdentityType() { + } + + /** + * Creates or finds a IdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IdentityType. + */ + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsInfo.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsInfo.java new file mode 100644 index 000000000000..5a609c8ff851 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsInfo.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary information about the incompatible feature id, number of objects impacted and category of issue + * (warning/error). + */ +@Immutable +public final class ImpactedObjectsInfo implements JsonSerializable { + /* + * Represents the feature id from + * https://learn.microsoft.com/en-us/data-migration/sql-server/database/assessment-rules?view=azuresql. OR + * https://learn.microsoft.com/en-us/data-migration/sql-server/managed-instance/assessment-rules?view=azuresql + */ + private String featureId; + + /* + * Represents the number of issues/warnings. + */ + private Integer numberImpacted; + + /* + * Issue or Warning + */ + private String issueCategory; + + /** + * Creates an instance of ImpactedObjectsInfo class. + */ + private ImpactedObjectsInfo() { + } + + /** + * Get the featureId property: Represents the feature id from + * https://learn.microsoft.com/en-us/data-migration/sql-server/database/assessment-rules?view=azuresql. OR + * https://learn.microsoft.com/en-us/data-migration/sql-server/managed-instance/assessment-rules?view=azuresql. + * + * @return the featureId value. + */ + public String featureId() { + return this.featureId; + } + + /** + * Get the numberImpacted property: Represents the number of issues/warnings. + * + * @return the numberImpacted value. + */ + public Integer numberImpacted() { + return this.numberImpacted; + } + + /** + * Get the issueCategory property: Issue or Warning. + * + * @return the issueCategory value. + */ + public String issueCategory() { + return this.issueCategory; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureId", this.featureId); + jsonWriter.writeNumberField("numberImpacted", this.numberImpacted); + jsonWriter.writeStringField("issueCategory", this.issueCategory); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImpactedObjectsInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImpactedObjectsInfo if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ImpactedObjectsInfo. + */ + public static ImpactedObjectsInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImpactedObjectsInfo deserializedImpactedObjectsInfo = new ImpactedObjectsInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureId".equals(fieldName)) { + deserializedImpactedObjectsInfo.featureId = reader.getString(); + } else if ("numberImpacted".equals(fieldName)) { + deserializedImpactedObjectsInfo.numberImpacted = reader.getNullable(JsonReader::getInt); + } else if ("issueCategory".equals(fieldName)) { + deserializedImpactedObjectsInfo.issueCategory = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedImpactedObjectsInfo; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsSuitabilitySummary.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsSuitabilitySummary.java new file mode 100644 index 000000000000..b148b0a0569d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsSuitabilitySummary.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Represents a summary of migration readiness issues/warnings per feature type for Azure SQL DB and SQL MI targets. + */ +@Immutable +public final class ImpactedObjectsSuitabilitySummary implements JsonSerializable { + /* + * The azureSqlDatabase property. + */ + private List azureSqlDatabase; + + /* + * The azureSqlManagedInstance property. + */ + private List azureSqlManagedInstance; + + /** + * Creates an instance of ImpactedObjectsSuitabilitySummary class. + */ + public ImpactedObjectsSuitabilitySummary() { + } + + /** + * Get the azureSqlDatabase property: The azureSqlDatabase property. + * + * @return the azureSqlDatabase value. + */ + public List azureSqlDatabase() { + return this.azureSqlDatabase; + } + + /** + * Get the azureSqlManagedInstance property: The azureSqlManagedInstance property. + * + * @return the azureSqlManagedInstance value. + */ + public List azureSqlManagedInstance() { + return this.azureSqlManagedInstance; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImpactedObjectsSuitabilitySummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImpactedObjectsSuitabilitySummary if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ImpactedObjectsSuitabilitySummary. + */ + public static ImpactedObjectsSuitabilitySummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImpactedObjectsSuitabilitySummary deserializedImpactedObjectsSuitabilitySummary + = new ImpactedObjectsSuitabilitySummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureSqlDatabase".equals(fieldName)) { + List azureSqlDatabase + = reader.readArray(reader1 -> ImpactedObjectsInfo.fromJson(reader1)); + deserializedImpactedObjectsSuitabilitySummary.azureSqlDatabase = azureSqlDatabase; + } else if ("azureSqlManagedInstance".equals(fieldName)) { + List azureSqlManagedInstance + = reader.readArray(reader1 -> ImpactedObjectsInfo.fromJson(reader1)); + deserializedImpactedObjectsSuitabilitySummary.azureSqlManagedInstance = azureSqlManagedInstance; + } else { + reader.skipChildren(); + } + } + + return deserializedImpactedObjectsSuitabilitySummary; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java index b40e8a40fde0..369e361798ee 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -9,32 +9,32 @@ */ public enum Infrastructure { /** - * Enum value azure. + * azure. */ AZURE("azure"), /** - * Enum value gcp. + * gcp. */ GCP("gcp"), /** - * Enum value aws. + * aws. */ AWS("aws"), /** - * Enum value alibaba. + * alibaba. */ ALIBABA("alibaba"), /** - * Enum value onpremises. + * onpremises. */ ONPREMISES("onpremises"), /** - * Enum value other. + * other. */ OTHER("other"); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InitiatedFrom.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InitiatedFrom.java new file mode 100644 index 000000000000..a25c4c656731 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InitiatedFrom.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * To indicate the client from which the migration is initiated from e.g. Azure Arc, DMS-Azure Portal/PS/CLI for + * additional tracking. + */ +public final class InitiatedFrom extends ExpandableStringEnum { + /** + * Migration is initiated from Azure Arc enabled clients. + */ + public static final InitiatedFrom AZURE_ARC = fromString("Azure Arc"); + + /** + * Migration is initiated from Azure Data Studio (ADS). + */ + public static final InitiatedFrom ADS = fromString("ADS"); + + /** + * Migration is initiated from SQL Server Management Studio (SSMS). + */ + public static final InitiatedFrom SSMS = fromString("SSMS"); + + /** + * Migration is initiated from SQL Server Migration Assistant (SSMA). + */ + public static final InitiatedFrom SSMA = fromString("SSMA"); + + /** + * Migration is initiated from Azure Database Migration Service(DMS) Azure Portal. + */ + public static final InitiatedFrom DMSPORTAL = fromString("DMS-Portal"); + + /** + * Migration is initiated from DMS using PowerShell - Azure DataMigration Service Module. + */ + public static final InitiatedFrom DMSPS = fromString("DMS-PS"); + + /** + * Migration is initiated from DMS using datamigration extension for the Azure CLI. + */ + public static final InitiatedFrom DMSCLI = fromString("DMS-CLI"); + + /** + * Migration is initiated from Azure Database Migration Service SDK like Python or .NET SDKs. + */ + public static final InitiatedFrom DMSSDK = fromString("DMS-SDK"); + + /** + * Migration is initiated from any other client not listed above. + */ + public static final InitiatedFrom OTHER = fromString("Other"); + + /** + * Creates a new instance of InitiatedFrom value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public InitiatedFrom() { + } + + /** + * Creates or finds a InitiatedFrom from its string representation. + * + * @param name a name to look for. + * @return the corresponding InitiatedFrom. + */ + public static InitiatedFrom fromString(String name) { + return fromString(name, InitiatedFrom.class); + } + + /** + * Gets known InitiatedFrom values. + * + * @return known InitiatedFrom values. + */ + public static Collection values() { + return values(InitiatedFrom.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java new file mode 100644 index 000000000000..74699b82a377 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The role of the SQL managed instance in this failover group. + */ +public final class InstanceFailoverGroupRole extends ExpandableStringEnum { + /** + * primary. + */ + public static final InstanceFailoverGroupRole PRIMARY = fromString("primary"); + + /** + * secondary. + */ + public static final InstanceFailoverGroupRole SECONDARY = fromString("secondary"); + + /** + * force-primary-allow-data-loss. + */ + public static final InstanceFailoverGroupRole FORCE_PRIMARY_ALLOW_DATA_LOSS + = fromString("force-primary-allow-data-loss"); + + /** + * force-secondary. + */ + public static final InstanceFailoverGroupRole FORCE_SECONDARY = fromString("force-secondary"); + + /** + * Creates a new instance of InstanceFailoverGroupRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public InstanceFailoverGroupRole() { + } + + /** + * Creates or finds a InstanceFailoverGroupRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstanceFailoverGroupRole. + */ + public static InstanceFailoverGroupRole fromString(String name) { + return fromString(name, InstanceFailoverGroupRole.class); + } + + /** + * Gets known InstanceFailoverGroupRole values. + * + * @return known InstanceFailoverGroupRole values. + */ + public static Collection values() { + return values(InstanceFailoverGroupRole.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java new file mode 100644 index 000000000000..2bf7526d7f7a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Represents the current status of the target recommendation job. + */ +public final class JobStatus extends ExpandableStringEnum { + /** + * NotStarted. + */ + public static final JobStatus NOT_STARTED = fromString("NotStarted"); + + /** + * InProgress. + */ + public static final JobStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Succeeded. + */ + public static final JobStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Failed. + */ + public static final JobStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of JobStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public JobStatus() { + } + + /** + * Creates or finds a JobStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobStatus. + */ + public static JobStatus fromString(String name) { + return fromString(name, JobStatus.class); + } + + /** + * Gets known JobStatus values. + * + * @return known JobStatus values. + */ + public static Collection values() { + return values(JobStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java new file mode 100644 index 000000000000..139d1c5fd1b8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The kubernetes active directory information. + */ +@Fluent +public final class K8SActiveDirectory implements JsonSerializable { + /* + * The connector property. + */ + private K8SActiveDirectoryConnector connector; + + /* + * Account name for AAD + */ + private String accountName; + + /* + * Keytab secret used to authenticate with Active Directory. + */ + private String keytabSecret; + + /* + * An array of encryption types + */ + private List encryptionTypes; + + /** + * Creates an instance of K8SActiveDirectory class. + */ + public K8SActiveDirectory() { + } + + /** + * Get the connector property: The connector property. + * + * @return the connector value. + */ + public K8SActiveDirectoryConnector connector() { + return this.connector; + } + + /** + * Set the connector property: The connector property. + * + * @param connector the connector value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withConnector(K8SActiveDirectoryConnector connector) { + this.connector = connector; + return this; + } + + /** + * Get the accountName property: Account name for AAD. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: Account name for AAD. + * + * @param accountName the accountName value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the keytabSecret property: Keytab secret used to authenticate with Active Directory. + * + * @return the keytabSecret value. + */ + public String keytabSecret() { + return this.keytabSecret; + } + + /** + * Set the keytabSecret property: Keytab secret used to authenticate with Active Directory. + * + * @param keytabSecret the keytabSecret value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withKeytabSecret(String keytabSecret) { + this.keytabSecret = keytabSecret; + return this; + } + + /** + * Get the encryptionTypes property: An array of encryption types. + * + * @return the encryptionTypes value. + */ + public List encryptionTypes() { + return this.encryptionTypes; + } + + /** + * Set the encryptionTypes property: An array of encryption types. + * + * @param encryptionTypes the encryptionTypes value to set. + * @return the K8SActiveDirectory object itself. + */ + public K8SActiveDirectory withEncryptionTypes(List encryptionTypes) { + this.encryptionTypes = encryptionTypes; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("connector", this.connector); + jsonWriter.writeStringField("accountName", this.accountName); + jsonWriter.writeStringField("keytabSecret", this.keytabSecret); + jsonWriter.writeArrayField("encryptionTypes", this.encryptionTypes, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SActiveDirectory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SActiveDirectory if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SActiveDirectory. + */ + public static K8SActiveDirectory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SActiveDirectory deserializedK8SActiveDirectory = new K8SActiveDirectory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connector".equals(fieldName)) { + deserializedK8SActiveDirectory.connector = K8SActiveDirectoryConnector.fromJson(reader); + } else if ("accountName".equals(fieldName)) { + deserializedK8SActiveDirectory.accountName = reader.getString(); + } else if ("keytabSecret".equals(fieldName)) { + deserializedK8SActiveDirectory.keytabSecret = reader.getString(); + } else if ("encryptionTypes".equals(fieldName)) { + List encryptionTypes = reader.readArray(reader1 -> reader1.getString()); + deserializedK8SActiveDirectory.encryptionTypes = encryptionTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedK8SActiveDirectory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java new file mode 100644 index 000000000000..6f67d8f54402 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The K8SActiveDirectoryConnector model. + */ +@Fluent +public final class K8SActiveDirectoryConnector implements JsonSerializable { + /* + * Name of the connector + */ + private String name; + + /* + * Name space of the connector + */ + private String namespace; + + /** + * Creates an instance of K8SActiveDirectoryConnector class. + */ + public K8SActiveDirectoryConnector() { + } + + /** + * Get the name property: Name of the connector. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the connector. + * + * @param name the name value to set. + * @return the K8SActiveDirectoryConnector object itself. + */ + public K8SActiveDirectoryConnector withName(String name) { + this.name = name; + return this; + } + + /** + * Get the namespace property: Name space of the connector. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Name space of the connector. + * + * @param namespace the namespace value to set. + * @return the K8SActiveDirectoryConnector object itself. + */ + public K8SActiveDirectoryConnector withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("namespace", this.namespace); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SActiveDirectoryConnector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SActiveDirectoryConnector if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SActiveDirectoryConnector. + */ + public static K8SActiveDirectoryConnector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SActiveDirectoryConnector deserializedK8SActiveDirectoryConnector = new K8SActiveDirectoryConnector(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedK8SActiveDirectoryConnector.name = reader.getString(); + } else if ("namespace".equals(fieldName)) { + deserializedK8SActiveDirectoryConnector.namespace = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedK8SActiveDirectoryConnector; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java new file mode 100644 index 000000000000..4926c105ff90 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The kubernetes network settings information. + */ +@Fluent +public final class K8SNetworkSettings implements JsonSerializable { + /* + * If 1, then SQL Server forces all connections to be encrypted. By default, this option is 0 + */ + private Integer forceencryption; + + /* + * Specifies which ciphers are allowed by SQL Server for TLS + */ + private String tlsciphers; + + /* + * A comma-separated list of which TLS protocols are allowed by SQL Server + */ + private String tlsprotocols; + + /** + * Creates an instance of K8SNetworkSettings class. + */ + public K8SNetworkSettings() { + } + + /** + * Get the forceencryption property: If 1, then SQL Server forces all connections to be encrypted. By default, this + * option is 0. + * + * @return the forceencryption value. + */ + public Integer forceencryption() { + return this.forceencryption; + } + + /** + * Set the forceencryption property: If 1, then SQL Server forces all connections to be encrypted. By default, this + * option is 0. + * + * @param forceencryption the forceencryption value to set. + * @return the K8SNetworkSettings object itself. + */ + public K8SNetworkSettings withForceencryption(Integer forceencryption) { + this.forceencryption = forceencryption; + return this; + } + + /** + * Get the tlsciphers property: Specifies which ciphers are allowed by SQL Server for TLS. + * + * @return the tlsciphers value. + */ + public String tlsciphers() { + return this.tlsciphers; + } + + /** + * Set the tlsciphers property: Specifies which ciphers are allowed by SQL Server for TLS. + * + * @param tlsciphers the tlsciphers value to set. + * @return the K8SNetworkSettings object itself. + */ + public K8SNetworkSettings withTlsciphers(String tlsciphers) { + this.tlsciphers = tlsciphers; + return this; + } + + /** + * Get the tlsprotocols property: A comma-separated list of which TLS protocols are allowed by SQL Server. + * + * @return the tlsprotocols value. + */ + public String tlsprotocols() { + return this.tlsprotocols; + } + + /** + * Set the tlsprotocols property: A comma-separated list of which TLS protocols are allowed by SQL Server. + * + * @param tlsprotocols the tlsprotocols value to set. + * @return the K8SNetworkSettings object itself. + */ + public K8SNetworkSettings withTlsprotocols(String tlsprotocols) { + this.tlsprotocols = tlsprotocols; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("forceencryption", this.forceencryption); + jsonWriter.writeStringField("tlsciphers", this.tlsciphers); + jsonWriter.writeStringField("tlsprotocols", this.tlsprotocols); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SNetworkSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SNetworkSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SNetworkSettings. + */ + public static K8SNetworkSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SNetworkSettings deserializedK8SNetworkSettings = new K8SNetworkSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("forceencryption".equals(fieldName)) { + deserializedK8SNetworkSettings.forceencryption = reader.getNullable(JsonReader::getInt); + } else if ("tlsciphers".equals(fieldName)) { + deserializedK8SNetworkSettings.tlsciphers = reader.getString(); + } else if ("tlsprotocols".equals(fieldName)) { + deserializedK8SNetworkSettings.tlsprotocols = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedK8SNetworkSettings; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java index 23e525f4f2ca..48b71eb130d9 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -113,14 +113,6 @@ public K8SResourceRequirements withAdditionalProperties(Map addi return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java index efa5fa454adf..ac38e558d60a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -77,17 +77,6 @@ public K8SScheduling withAdditionalProperties(Map additionalProp return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (defaultProperty() != null) { - defaultProperty().validate(); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java index 9fe29b6175e8..7f62c8ec9d0e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -80,17 +80,6 @@ public K8SSchedulingOptions withAdditionalProperties(Map additio return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (resources() != null) { - resources().validate(); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java new file mode 100644 index 000000000000..3ce4d2a8c521 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The kubernetes security information. + */ +@Fluent +public final class K8SSecurity implements JsonSerializable { + /* + * Admin login secret key + */ + private String adminLoginSecret; + + /* + * Service certificate secret used + */ + private String serviceCertificateSecret; + + /* + * The kubernetes active directory information. + */ + private K8SActiveDirectory activeDirectory; + + /* + * Transparent data encryption information. + */ + private K8STransparentDataEncryption transparentDataEncryption; + + /* + * The kubernetes security information. + */ + private Map additionalProperties; + + /** + * Creates an instance of K8SSecurity class. + */ + public K8SSecurity() { + } + + /** + * Get the adminLoginSecret property: Admin login secret key. + * + * @return the adminLoginSecret value. + */ + public String adminLoginSecret() { + return this.adminLoginSecret; + } + + /** + * Set the adminLoginSecret property: Admin login secret key. + * + * @param adminLoginSecret the adminLoginSecret value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withAdminLoginSecret(String adminLoginSecret) { + this.adminLoginSecret = adminLoginSecret; + return this; + } + + /** + * Get the serviceCertificateSecret property: Service certificate secret used. + * + * @return the serviceCertificateSecret value. + */ + public String serviceCertificateSecret() { + return this.serviceCertificateSecret; + } + + /** + * Set the serviceCertificateSecret property: Service certificate secret used. + * + * @param serviceCertificateSecret the serviceCertificateSecret value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withServiceCertificateSecret(String serviceCertificateSecret) { + this.serviceCertificateSecret = serviceCertificateSecret; + return this; + } + + /** + * Get the activeDirectory property: The kubernetes active directory information. + * + * @return the activeDirectory value. + */ + public K8SActiveDirectory activeDirectory() { + return this.activeDirectory; + } + + /** + * Set the activeDirectory property: The kubernetes active directory information. + * + * @param activeDirectory the activeDirectory value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withActiveDirectory(K8SActiveDirectory activeDirectory) { + this.activeDirectory = activeDirectory; + return this; + } + + /** + * Get the transparentDataEncryption property: Transparent data encryption information. + * + * @return the transparentDataEncryption value. + */ + public K8STransparentDataEncryption transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Set the transparentDataEncryption property: Transparent data encryption information. + * + * @param transparentDataEncryption the transparentDataEncryption value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withTransparentDataEncryption(K8STransparentDataEncryption transparentDataEncryption) { + this.transparentDataEncryption = transparentDataEncryption; + return this; + } + + /** + * Get the additionalProperties property: The kubernetes security information. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The kubernetes security information. + * + * @param additionalProperties the additionalProperties value to set. + * @return the K8SSecurity object itself. + */ + public K8SSecurity withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("adminLoginSecret", this.adminLoginSecret); + jsonWriter.writeStringField("serviceCertificateSecret", this.serviceCertificateSecret); + jsonWriter.writeJsonField("activeDirectory", this.activeDirectory); + jsonWriter.writeJsonField("transparentDataEncryption", this.transparentDataEncryption); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SSecurity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SSecurity if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SSecurity. + */ + public static K8SSecurity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SSecurity deserializedK8SSecurity = new K8SSecurity(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("adminLoginSecret".equals(fieldName)) { + deserializedK8SSecurity.adminLoginSecret = reader.getString(); + } else if ("serviceCertificateSecret".equals(fieldName)) { + deserializedK8SSecurity.serviceCertificateSecret = reader.getString(); + } else if ("activeDirectory".equals(fieldName)) { + deserializedK8SSecurity.activeDirectory = K8SActiveDirectory.fromJson(reader); + } else if ("transparentDataEncryption".equals(fieldName)) { + deserializedK8SSecurity.transparentDataEncryption = K8STransparentDataEncryption.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SSecurity.additionalProperties = additionalProperties; + + return deserializedK8SSecurity; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java new file mode 100644 index 000000000000..e02e51c2dc8a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The kubernetes settings information. + */ +@Fluent +public final class K8SSettings implements JsonSerializable { + /* + * The kubernetes network settings information. + */ + private K8SNetworkSettings network; + + /* + * The kubernetes settings information. + */ + private Map additionalProperties; + + /** + * Creates an instance of K8SSettings class. + */ + public K8SSettings() { + } + + /** + * Get the network property: The kubernetes network settings information. + * + * @return the network value. + */ + public K8SNetworkSettings network() { + return this.network; + } + + /** + * Set the network property: The kubernetes network settings information. + * + * @param network the network value to set. + * @return the K8SSettings object itself. + */ + public K8SSettings withNetwork(K8SNetworkSettings network) { + this.network = network; + return this; + } + + /** + * Get the additionalProperties property: The kubernetes settings information. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The kubernetes settings information. + * + * @param additionalProperties the additionalProperties value to set. + * @return the K8SSettings object itself. + */ + public K8SSettings withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("network", this.network); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8SSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8SSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the K8SSettings. + */ + public static K8SSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8SSettings deserializedK8SSettings = new K8SSettings(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("network".equals(fieldName)) { + deserializedK8SSettings.network = K8SNetworkSettings.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedK8SSettings.additionalProperties = additionalProperties; + + return deserializedK8SSettings; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8STransparentDataEncryption.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8STransparentDataEncryption.java new file mode 100644 index 000000000000..86536cdc3eb4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/K8STransparentDataEncryption.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Transparent data encryption information. + */ +@Fluent +public final class K8STransparentDataEncryption implements JsonSerializable { + /* + * Transparent data encryption mode. Can be Service Managed, Customer managed or disabled + */ + private String mode; + + /* + * Protector secret for customer managed Transparent data encryption mode + */ + private String protectorSecret; + + /** + * Creates an instance of K8STransparentDataEncryption class. + */ + public K8STransparentDataEncryption() { + } + + /** + * Get the mode property: Transparent data encryption mode. Can be Service Managed, Customer managed or disabled. + * + * @return the mode value. + */ + public String mode() { + return this.mode; + } + + /** + * Set the mode property: Transparent data encryption mode. Can be Service Managed, Customer managed or disabled. + * + * @param mode the mode value to set. + * @return the K8STransparentDataEncryption object itself. + */ + public K8STransparentDataEncryption withMode(String mode) { + this.mode = mode; + return this; + } + + /** + * Get the protectorSecret property: Protector secret for customer managed Transparent data encryption mode. + * + * @return the protectorSecret value. + */ + public String protectorSecret() { + return this.protectorSecret; + } + + /** + * Set the protectorSecret property: Protector secret for customer managed Transparent data encryption mode. + * + * @param protectorSecret the protectorSecret value to set. + * @return the K8STransparentDataEncryption object itself. + */ + public K8STransparentDataEncryption withProtectorSecret(String protectorSecret) { + this.protectorSecret = protectorSecret; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode); + jsonWriter.writeStringField("protectorSecret", this.protectorSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of K8STransparentDataEncryption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of K8STransparentDataEncryption if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the K8STransparentDataEncryption. + */ + public static K8STransparentDataEncryption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + K8STransparentDataEncryption deserializedK8STransparentDataEncryption = new K8STransparentDataEncryption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedK8STransparentDataEncryption.mode = reader.getString(); + } else if ("protectorSecret".equals(fieldName)) { + deserializedK8STransparentDataEncryption.protectorSecret = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedK8STransparentDataEncryption; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java new file mode 100644 index 000000000000..98c7c15cbdfa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Keytab used for authenticate with Active Directory. + */ +@Fluent +public final class KeytabInformation implements JsonSerializable { + /* + * A base64-encoded keytab. + */ + private String keytab; + + /** + * Creates an instance of KeytabInformation class. + */ + public KeytabInformation() { + } + + /** + * Get the keytab property: A base64-encoded keytab. + * + * @return the keytab value. + */ + public String keytab() { + return this.keytab; + } + + /** + * Set the keytab property: A base64-encoded keytab. + * + * @param keytab the keytab value to set. + * @return the KeytabInformation object itself. + */ + public KeytabInformation withKeytab(String keytab) { + this.keytab = keytab; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keytab", this.keytab); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeytabInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeytabInformation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the KeytabInformation. + */ + public static KeytabInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeytabInformation deserializedKeytabInformation = new KeytabInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keytab".equals(fieldName)) { + deserializedKeytabInformation.keytab = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeytabInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java new file mode 100644 index 000000000000..d15504ef7c6c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The last execution status of the background job. + */ +public final class LastExecutionStatus extends ExpandableStringEnum { + /** + * Succeeded. + */ + public static final LastExecutionStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Completed. + */ + public static final LastExecutionStatus COMPLETED = fromString("Completed"); + + /** + * Failed. + */ + public static final LastExecutionStatus FAILED = fromString("Failed"); + + /** + * Faulted. + */ + public static final LastExecutionStatus FAULTED = fromString("Faulted"); + + /** + * Postponed. + */ + public static final LastExecutionStatus POSTPONED = fromString("Postponed"); + + /** + * Rescheduled. + */ + public static final LastExecutionStatus RESCHEDULED = fromString("Rescheduled"); + + /** + * Creates a new instance of LastExecutionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LastExecutionStatus() { + } + + /** + * Creates or finds a LastExecutionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding LastExecutionStatus. + */ + public static LastExecutionStatus fromString(String name) { + return fromString(name, LastExecutionStatus.class); + } + + /** + * Gets known LastExecutionStatus values. + * + * @return known LastExecutionStatus values. + */ + public static Collection values() { + return values(LastExecutionStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java new file mode 100644 index 000000000000..cc9b95962829 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * This property represents the choice between SQL Server Core and ESU licenses. + */ +public final class LicenseCategory extends ExpandableStringEnum { + /** + * Core. + */ + public static final LicenseCategory CORE = fromString("Core"); + + /** + * Creates a new instance of LicenseCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LicenseCategory() { + } + + /** + * Creates or finds a LicenseCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding LicenseCategory. + */ + public static LicenseCategory fromString(String name) { + return fromString(name, LicenseCategory.class); + } + + /** + * Gets known LicenseCategory values. + * + * @return known LicenseCategory values. + */ + public static Collection values() { + return values(LicenseCategory.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java index ed5542f03bf9..11cae23a0824 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -10,8 +10,6 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; -import java.util.Objects; -import java.util.UUID; /** * Log analytics workspace id and primary key. @@ -21,7 +19,7 @@ public final class LogAnalyticsWorkspaceConfig implements JsonSerializable UUID.fromString(nonNullReader.getString())); + deserializedLogAnalyticsWorkspaceConfig.workspaceId = reader.getString(); } else if ("primaryKey".equals(fieldName)) { deserializedLogAnalyticsWorkspaceConfig.primaryKey = reader.getString(); } else { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ManagedInstanceLinkCreateUpdateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ManagedInstanceLinkCreateUpdateConfiguration.java new file mode 100644 index 000000000000..66f1d1455af5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ManagedInstanceLinkCreateUpdateConfiguration.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The configuration for the new Managed Instance Link resource. + */ +@Fluent +public final class ManagedInstanceLinkCreateUpdateConfiguration + implements JsonSerializable { + /* + * The configuration for the SQL Server availability group resource. + */ + private AvailabilityGroupCreateUpdateConfiguration availabilityGroup; + + /* + * The distributed availability group configuration for the MI link. + */ + private DistributedAvailabilityGroupCreateUpdateConfiguration distributedAvailabilityGroup; + + /* + * The MI Link specific distributed availability group configuration. + */ + private MiLinkCreateUpdateConfiguration miLinkConfiguration; + + /** + * Creates an instance of ManagedInstanceLinkCreateUpdateConfiguration class. + */ + public ManagedInstanceLinkCreateUpdateConfiguration() { + } + + /** + * Get the availabilityGroup property: The configuration for the SQL Server availability group resource. + * + * @return the availabilityGroup value. + */ + public AvailabilityGroupCreateUpdateConfiguration availabilityGroup() { + return this.availabilityGroup; + } + + /** + * Set the availabilityGroup property: The configuration for the SQL Server availability group resource. + * + * @param availabilityGroup the availabilityGroup value to set. + * @return the ManagedInstanceLinkCreateUpdateConfiguration object itself. + */ + public ManagedInstanceLinkCreateUpdateConfiguration + withAvailabilityGroup(AvailabilityGroupCreateUpdateConfiguration availabilityGroup) { + this.availabilityGroup = availabilityGroup; + return this; + } + + /** + * Get the distributedAvailabilityGroup property: The distributed availability group configuration for the MI link. + * + * @return the distributedAvailabilityGroup value. + */ + public DistributedAvailabilityGroupCreateUpdateConfiguration distributedAvailabilityGroup() { + return this.distributedAvailabilityGroup; + } + + /** + * Set the distributedAvailabilityGroup property: The distributed availability group configuration for the MI link. + * + * @param distributedAvailabilityGroup the distributedAvailabilityGroup value to set. + * @return the ManagedInstanceLinkCreateUpdateConfiguration object itself. + */ + public ManagedInstanceLinkCreateUpdateConfiguration withDistributedAvailabilityGroup( + DistributedAvailabilityGroupCreateUpdateConfiguration distributedAvailabilityGroup) { + this.distributedAvailabilityGroup = distributedAvailabilityGroup; + return this; + } + + /** + * Get the miLinkConfiguration property: The MI Link specific distributed availability group configuration. + * + * @return the miLinkConfiguration value. + */ + public MiLinkCreateUpdateConfiguration miLinkConfiguration() { + return this.miLinkConfiguration; + } + + /** + * Set the miLinkConfiguration property: The MI Link specific distributed availability group configuration. + * + * @param miLinkConfiguration the miLinkConfiguration value to set. + * @return the ManagedInstanceLinkCreateUpdateConfiguration object itself. + */ + public ManagedInstanceLinkCreateUpdateConfiguration + withMiLinkConfiguration(MiLinkCreateUpdateConfiguration miLinkConfiguration) { + this.miLinkConfiguration = miLinkConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("availabilityGroup", this.availabilityGroup); + jsonWriter.writeJsonField("distributedAvailabilityGroup", this.distributedAvailabilityGroup); + jsonWriter.writeJsonField("miLinkConfiguration", this.miLinkConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedInstanceLinkCreateUpdateConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedInstanceLinkCreateUpdateConfiguration if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedInstanceLinkCreateUpdateConfiguration. + */ + public static ManagedInstanceLinkCreateUpdateConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedInstanceLinkCreateUpdateConfiguration deserializedManagedInstanceLinkCreateUpdateConfiguration + = new ManagedInstanceLinkCreateUpdateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroup".equals(fieldName)) { + deserializedManagedInstanceLinkCreateUpdateConfiguration.availabilityGroup + = AvailabilityGroupCreateUpdateConfiguration.fromJson(reader); + } else if ("distributedAvailabilityGroup".equals(fieldName)) { + deserializedManagedInstanceLinkCreateUpdateConfiguration.distributedAvailabilityGroup + = DistributedAvailabilityGroupCreateUpdateConfiguration.fromJson(reader); + } else if ("miLinkConfiguration".equals(fieldName)) { + deserializedManagedInstanceLinkCreateUpdateConfiguration.miLinkConfiguration + = MiLinkCreateUpdateConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedInstanceLinkCreateUpdateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkAssessmentCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkAssessmentCategory.java new file mode 100644 index 000000000000..79907f046e46 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkAssessmentCategory.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Validation category for the MI Link prerequisites assessment. + */ +public final class MiLinkAssessmentCategory extends ExpandableStringEnum { + /** + * Assessments of the given instance on the on-premise SQL Server (box). + */ + public static final MiLinkAssessmentCategory SQL_INSTANCE = fromString("SqlInstance"); + + /** + * Assessments of the database(s) on the given instance on the on-premise SQL Server (box). + */ + public static final MiLinkAssessmentCategory SQL_INSTANCE_DATABASE = fromString("SqlInstanceDatabase"); + + /** + * Assessments of the Managed Instance. + */ + public static final MiLinkAssessmentCategory MANAGED_INSTANCE = fromString("ManagedInstance"); + + /** + * Assessments of the database(s) on the Managed Instance. + */ + public static final MiLinkAssessmentCategory MANAGED_INSTANCE_DATABASE = fromString("ManagedInstanceDatabase"); + + /** + * Assessments that use data from both the Managed Instance and the given instance of the on-premise SQL Server + * (box) for the validations. + */ + public static final MiLinkAssessmentCategory MANAGED_INSTANCE_CROSS_VALIDATION + = fromString("ManagedInstanceCrossValidation"); + + /** + * Assessments of the necessary certificates configuration. + */ + public static final MiLinkAssessmentCategory CERTIFICATES = fromString("Certificates"); + + /** + * Assessment of network connectivity from the on-premise SQL Server (box) to the Managed Instance. + */ + public static final MiLinkAssessmentCategory BOX_TO_MI_NETWORK_CONNECTIVITY + = fromString("BoxToMiNetworkConnectivity"); + + /** + * Assessments of network connectivity from the Managed Instance to the on-premise SQL Server (box). + */ + public static final MiLinkAssessmentCategory MI_TO_BOX_NETWORK_CONNECTIVITY + = fromString("MiToBoxNetworkConnectivity"); + + /** + * Assessments of the chosen Availability Group. + */ + public static final MiLinkAssessmentCategory SQL_INSTANCE_AG = fromString("SqlInstanceAg"); + + /** + * Assessments of the chosen Distributed Availability Group. + */ + public static final MiLinkAssessmentCategory DAG_CROSS_VALIDATION = fromString("DagCrossValidation"); + + /** + * Creates a new instance of MiLinkAssessmentCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MiLinkAssessmentCategory() { + } + + /** + * Creates or finds a MiLinkAssessmentCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding MiLinkAssessmentCategory. + */ + public static MiLinkAssessmentCategory fromString(String name) { + return fromString(name, MiLinkAssessmentCategory.class); + } + + /** + * Gets known MiLinkAssessmentCategory values. + * + * @return known MiLinkAssessmentCategory values. + */ + public static Collection values() { + return values(MiLinkAssessmentCategory.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkCreateUpdateConfiguration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkCreateUpdateConfiguration.java new file mode 100644 index 000000000000..4e3e49aa538f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkCreateUpdateConfiguration.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The MI Link specific configuration. + */ +@Fluent +public final class MiLinkCreateUpdateConfiguration implements JsonSerializable { + /* + * The name of the availability group to be created on the Managed Instance. + */ + private String instanceAvailabilityGroupName; + + /** + * Creates an instance of MiLinkCreateUpdateConfiguration class. + */ + public MiLinkCreateUpdateConfiguration() { + } + + /** + * Get the instanceAvailabilityGroupName property: The name of the availability group to be created on the Managed + * Instance. + * + * @return the instanceAvailabilityGroupName value. + */ + public String instanceAvailabilityGroupName() { + return this.instanceAvailabilityGroupName; + } + + /** + * Set the instanceAvailabilityGroupName property: The name of the availability group to be created on the Managed + * Instance. + * + * @param instanceAvailabilityGroupName the instanceAvailabilityGroupName value to set. + * @return the MiLinkCreateUpdateConfiguration object itself. + */ + public MiLinkCreateUpdateConfiguration withInstanceAvailabilityGroupName(String instanceAvailabilityGroupName) { + this.instanceAvailabilityGroupName = instanceAvailabilityGroupName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("instanceAvailabilityGroupName", this.instanceAvailabilityGroupName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MiLinkCreateUpdateConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MiLinkCreateUpdateConfiguration if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MiLinkCreateUpdateConfiguration. + */ + public static MiLinkCreateUpdateConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MiLinkCreateUpdateConfiguration deserializedMiLinkCreateUpdateConfiguration + = new MiLinkCreateUpdateConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceAvailabilityGroupName".equals(fieldName)) { + deserializedMiLinkCreateUpdateConfiguration.instanceAvailabilityGroupName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMiLinkCreateUpdateConfiguration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java new file mode 100644 index 000000000000..a1268cdce54b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Migration related configuration. + */ +@Fluent +public final class Migration implements JsonSerializable { + /* + * Migration assessments related configuration. + */ + private MigrationAssessment assessment; + + /* + * The last time when the target resource was selected for migration. + */ + private OffsetDateTime targetSelectedTime; + + /* + * Resource Id of the created or selected target SQL resource for migration. + */ + private String targetResourceId; + + /** + * Creates an instance of Migration class. + */ + public Migration() { + } + + /** + * Get the assessment property: Migration assessments related configuration. + * + * @return the assessment value. + */ + public MigrationAssessment assessment() { + return this.assessment; + } + + /** + * Set the assessment property: Migration assessments related configuration. + * + * @param assessment the assessment value to set. + * @return the Migration object itself. + */ + public Migration withAssessment(MigrationAssessment assessment) { + this.assessment = assessment; + return this; + } + + /** + * Get the targetSelectedTime property: The last time when the target resource was selected for migration. + * + * @return the targetSelectedTime value. + */ + public OffsetDateTime targetSelectedTime() { + return this.targetSelectedTime; + } + + /** + * Set the targetSelectedTime property: The last time when the target resource was selected for migration. + * + * @param targetSelectedTime the targetSelectedTime value to set. + * @return the Migration object itself. + */ + public Migration withTargetSelectedTime(OffsetDateTime targetSelectedTime) { + this.targetSelectedTime = targetSelectedTime; + return this; + } + + /** + * Get the targetResourceId property: Resource Id of the created or selected target SQL resource for migration. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: Resource Id of the created or selected target SQL resource for migration. + * + * @param targetResourceId the targetResourceId value to set. + * @return the Migration object itself. + */ + public Migration withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("assessment", this.assessment); + jsonWriter.writeStringField("targetSelectedTime", + this.targetSelectedTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.targetSelectedTime)); + jsonWriter.writeStringField("targetResourceId", this.targetResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Migration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Migration if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Migration. + */ + public static Migration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Migration deserializedMigration = new Migration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessment".equals(fieldName)) { + deserializedMigration.assessment = MigrationAssessment.fromJson(reader); + } else if ("targetSelectedTime".equals(fieldName)) { + deserializedMigration.targetSelectedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("targetResourceId".equals(fieldName)) { + deserializedMigration.targetResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMigration; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java new file mode 100644 index 000000000000..da1f95b07aac --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The migration assessment related configuration. + */ +@Fluent +public final class MigrationAssessment implements JsonSerializable { + /* + * Indicates if migration assessment is enabled for this SQL Server instance. + */ + private Boolean enabled; + + /* + * The time when Migration Assessment Report upload was last performed. + */ + private OffsetDateTime assessmentUploadTime; + + /* + * The time when this migration assessment was last viewed. + */ + private OffsetDateTime assessmentViewedTime; + + /* + * The UTC timestamp in ISO 8601 format indicating when the latest target recommendations were generated for this + * SQL Server instance. This value is set as part of a successful RunTargetRecommendation job and is independent of + * when the migration readiness results were uploaded (assessmentUploadTime). + */ + private OffsetDateTime targetRecommendationGenerationTime; + + /* + * version of this migration assessment report - to be passed by the migration assessment engine. + */ + private String version; + + /* + * Settings impacting the migration assessment computation - configurable with some default values if not set. + */ + private MigrationAssessmentSettings settings; + + /* + * Issues and warnings impacting the migration of SQL Server instance to particular Azure Migration Target. + */ + private List serverAssessments; + + /* + * SKU Recommendation results for Azure migration targets for SQL Server. + */ + private SkuRecommendationResults skuRecommendationResults; + + /* + * Represents a summary of migration readiness issues/warnings per feature type for Azure SQL DB and SQL MI targets + */ + private ImpactedObjectsSuitabilitySummary impactedObjectsSummary; + + /** + * Creates an instance of MigrationAssessment class. + */ + public MigrationAssessment() { + } + + /** + * Get the enabled property: Indicates if migration assessment is enabled for this SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if migration assessment is enabled for this SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the MigrationAssessment object itself. + */ + public MigrationAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the assessmentUploadTime property: The time when Migration Assessment Report upload was last performed. + * + * @return the assessmentUploadTime value. + */ + public OffsetDateTime assessmentUploadTime() { + return this.assessmentUploadTime; + } + + /** + * Get the assessmentViewedTime property: The time when this migration assessment was last viewed. + * + * @return the assessmentViewedTime value. + */ + public OffsetDateTime assessmentViewedTime() { + return this.assessmentViewedTime; + } + + /** + * Set the assessmentViewedTime property: The time when this migration assessment was last viewed. + * + * @param assessmentViewedTime the assessmentViewedTime value to set. + * @return the MigrationAssessment object itself. + */ + public MigrationAssessment withAssessmentViewedTime(OffsetDateTime assessmentViewedTime) { + this.assessmentViewedTime = assessmentViewedTime; + return this; + } + + /** + * Get the targetRecommendationGenerationTime property: The UTC timestamp in ISO 8601 format indicating when the + * latest target recommendations were generated for this SQL Server instance. This value is set as part of a + * successful RunTargetRecommendation job and is independent of when the migration readiness results were uploaded + * (assessmentUploadTime). + * + * @return the targetRecommendationGenerationTime value. + */ + public OffsetDateTime targetRecommendationGenerationTime() { + return this.targetRecommendationGenerationTime; + } + + /** + * Get the version property: version of this migration assessment report - to be passed by the migration assessment + * engine. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the settings property: Settings impacting the migration assessment computation - configurable with some + * default values if not set. + * + * @return the settings value. + */ + public MigrationAssessmentSettings settings() { + return this.settings; + } + + /** + * Set the settings property: Settings impacting the migration assessment computation - configurable with some + * default values if not set. + * + * @param settings the settings value to set. + * @return the MigrationAssessment object itself. + */ + public MigrationAssessment withSettings(MigrationAssessmentSettings settings) { + this.settings = settings; + return this; + } + + /** + * Get the serverAssessments property: Issues and warnings impacting the migration of SQL Server instance to + * particular Azure Migration Target. + * + * @return the serverAssessments value. + */ + public List serverAssessments() { + return this.serverAssessments; + } + + /** + * Get the skuRecommendationResults property: SKU Recommendation results for Azure migration targets for SQL Server. + * + * @return the skuRecommendationResults value. + */ + public SkuRecommendationResults skuRecommendationResults() { + return this.skuRecommendationResults; + } + + /** + * Get the impactedObjectsSummary property: Represents a summary of migration readiness issues/warnings per feature + * type for Azure SQL DB and SQL MI targets. + * + * @return the impactedObjectsSummary value. + */ + public ImpactedObjectsSuitabilitySummary impactedObjectsSummary() { + return this.impactedObjectsSummary; + } + + /** + * Set the impactedObjectsSummary property: Represents a summary of migration readiness issues/warnings per feature + * type for Azure SQL DB and SQL MI targets. + * + * @param impactedObjectsSummary the impactedObjectsSummary value to set. + * @return the MigrationAssessment object itself. + */ + public MigrationAssessment withImpactedObjectsSummary(ImpactedObjectsSuitabilitySummary impactedObjectsSummary) { + this.impactedObjectsSummary = impactedObjectsSummary; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("assessmentViewedTime", + this.assessmentViewedTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.assessmentViewedTime)); + jsonWriter.writeJsonField("settings", this.settings); + jsonWriter.writeJsonField("impactedObjectsSummary", this.impactedObjectsSummary); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MigrationAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MigrationAssessment if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MigrationAssessment. + */ + public static MigrationAssessment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MigrationAssessment deserializedMigrationAssessment = new MigrationAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedMigrationAssessment.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("assessmentUploadTime".equals(fieldName)) { + deserializedMigrationAssessment.assessmentUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("assessmentViewedTime".equals(fieldName)) { + deserializedMigrationAssessment.assessmentViewedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("targetRecommendationGenerationTime".equals(fieldName)) { + deserializedMigrationAssessment.targetRecommendationGenerationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("version".equals(fieldName)) { + deserializedMigrationAssessment.version = reader.getString(); + } else if ("settings".equals(fieldName)) { + deserializedMigrationAssessment.settings = MigrationAssessmentSettings.fromJson(reader); + } else if ("serverAssessments".equals(fieldName)) { + List serverAssessments + = reader.readArray(reader1 -> ServerAssessmentsItem.fromJson(reader1)); + deserializedMigrationAssessment.serverAssessments = serverAssessments; + } else if ("skuRecommendationResults".equals(fieldName)) { + deserializedMigrationAssessment.skuRecommendationResults + = SkuRecommendationResults.fromJson(reader); + } else if ("impactedObjectsSummary".equals(fieldName)) { + deserializedMigrationAssessment.impactedObjectsSummary + = ImpactedObjectsSuitabilitySummary.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMigrationAssessment; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessmentSettings.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessmentSettings.java new file mode 100644 index 000000000000..a5c9ccbca26e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessmentSettings.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Settings impacting the migration assessment computation - configurable with some default values if not set. + */ +@Fluent +public final class MigrationAssessmentSettings implements JsonSerializable { + /* + * The target location for Azure SQL SKU for migration. Default is West US. + */ + private String targetLocation; + + /* + * Indicate the percentile value for the performance sample. Default is 95th percentile. + */ + private Double percentile; + + /* + * How far back to check the performance data - Default is 30 (days). + */ + private Integer lookbackPeriodInDays; + + /* + * Buffer (percentage) to consider while SKU sizing to account for issues such as seasonal usage, short performance + * history, and likely increases in future usage - This buffer is applied on top of the performance metrics. Default + * is 100 (percent). + */ + private Integer comfortFactor; + + /* + * Minimize cost or Migrate to PaaS. - to evaluate based on the recommended strategy. Default is Migrate to PaaS + */ + private String strategy; + + /* + * currency to calculate prices - Default is USD. + */ + private String currency; + + /* + * flat discount percentage to apply for the price - Default is 0 + */ + private Double discountPercentage; + + /* + * Selected cost option value. + */ + private CostOptionSelectedValues costOptions; + + /** + * Creates an instance of MigrationAssessmentSettings class. + */ + public MigrationAssessmentSettings() { + } + + /** + * Get the targetLocation property: The target location for Azure SQL SKU for migration. Default is West US. + * + * @return the targetLocation value. + */ + public String targetLocation() { + return this.targetLocation; + } + + /** + * Set the targetLocation property: The target location for Azure SQL SKU for migration. Default is West US. + * + * @param targetLocation the targetLocation value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withTargetLocation(String targetLocation) { + this.targetLocation = targetLocation; + return this; + } + + /** + * Get the percentile property: Indicate the percentile value for the performance sample. Default is 95th + * percentile. + * + * @return the percentile value. + */ + public Double percentile() { + return this.percentile; + } + + /** + * Set the percentile property: Indicate the percentile value for the performance sample. Default is 95th + * percentile. + * + * @param percentile the percentile value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withPercentile(Double percentile) { + this.percentile = percentile; + return this; + } + + /** + * Get the lookbackPeriodInDays property: How far back to check the performance data - Default is 30 (days). + * + * @return the lookbackPeriodInDays value. + */ + public Integer lookbackPeriodInDays() { + return this.lookbackPeriodInDays; + } + + /** + * Set the lookbackPeriodInDays property: How far back to check the performance data - Default is 30 (days). + * + * @param lookbackPeriodInDays the lookbackPeriodInDays value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withLookbackPeriodInDays(Integer lookbackPeriodInDays) { + this.lookbackPeriodInDays = lookbackPeriodInDays; + return this; + } + + /** + * Get the comfortFactor property: Buffer (percentage) to consider while SKU sizing to account for issues such as + * seasonal usage, short performance history, and likely increases in future usage - This buffer is applied on top + * of the performance metrics. Default is 100 (percent). + * + * @return the comfortFactor value. + */ + public Integer comfortFactor() { + return this.comfortFactor; + } + + /** + * Set the comfortFactor property: Buffer (percentage) to consider while SKU sizing to account for issues such as + * seasonal usage, short performance history, and likely increases in future usage - This buffer is applied on top + * of the performance metrics. Default is 100 (percent). + * + * @param comfortFactor the comfortFactor value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withComfortFactor(Integer comfortFactor) { + this.comfortFactor = comfortFactor; + return this; + } + + /** + * Get the strategy property: Minimize cost or Migrate to PaaS. - to evaluate based on the recommended strategy. + * Default is Migrate to PaaS. + * + * @return the strategy value. + */ + public String strategy() { + return this.strategy; + } + + /** + * Set the strategy property: Minimize cost or Migrate to PaaS. - to evaluate based on the recommended strategy. + * Default is Migrate to PaaS. + * + * @param strategy the strategy value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withStrategy(String strategy) { + this.strategy = strategy; + return this; + } + + /** + * Get the currency property: currency to calculate prices - Default is USD. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Set the currency property: currency to calculate prices - Default is USD. + * + * @param currency the currency value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withCurrency(String currency) { + this.currency = currency; + return this; + } + + /** + * Get the discountPercentage property: flat discount percentage to apply for the price - Default is 0. + * + * @return the discountPercentage value. + */ + public Double discountPercentage() { + return this.discountPercentage; + } + + /** + * Set the discountPercentage property: flat discount percentage to apply for the price - Default is 0. + * + * @param discountPercentage the discountPercentage value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withDiscountPercentage(Double discountPercentage) { + this.discountPercentage = discountPercentage; + return this; + } + + /** + * Get the costOptions property: Selected cost option value. + * + * @return the costOptions value. + */ + public CostOptionSelectedValues costOptions() { + return this.costOptions; + } + + /** + * Set the costOptions property: Selected cost option value. + * + * @param costOptions the costOptions value to set. + * @return the MigrationAssessmentSettings object itself. + */ + public MigrationAssessmentSettings withCostOptions(CostOptionSelectedValues costOptions) { + this.costOptions = costOptions; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetLocation", this.targetLocation); + jsonWriter.writeNumberField("percentile", this.percentile); + jsonWriter.writeNumberField("lookbackPeriodInDays", this.lookbackPeriodInDays); + jsonWriter.writeNumberField("comfortFactor", this.comfortFactor); + jsonWriter.writeStringField("strategy", this.strategy); + jsonWriter.writeStringField("currency", this.currency); + jsonWriter.writeNumberField("discountPercentage", this.discountPercentage); + jsonWriter.writeJsonField("costOptions", this.costOptions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MigrationAssessmentSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MigrationAssessmentSettings if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MigrationAssessmentSettings. + */ + public static MigrationAssessmentSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MigrationAssessmentSettings deserializedMigrationAssessmentSettings = new MigrationAssessmentSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetLocation".equals(fieldName)) { + deserializedMigrationAssessmentSettings.targetLocation = reader.getString(); + } else if ("percentile".equals(fieldName)) { + deserializedMigrationAssessmentSettings.percentile = reader.getNullable(JsonReader::getDouble); + } else if ("lookbackPeriodInDays".equals(fieldName)) { + deserializedMigrationAssessmentSettings.lookbackPeriodInDays + = reader.getNullable(JsonReader::getInt); + } else if ("comfortFactor".equals(fieldName)) { + deserializedMigrationAssessmentSettings.comfortFactor = reader.getNullable(JsonReader::getInt); + } else if ("strategy".equals(fieldName)) { + deserializedMigrationAssessmentSettings.strategy = reader.getString(); + } else if ("currency".equals(fieldName)) { + deserializedMigrationAssessmentSettings.currency = reader.getString(); + } else if ("discountPercentage".equals(fieldName)) { + deserializedMigrationAssessmentSettings.discountPercentage + = reader.getNullable(JsonReader::getDouble); + } else if ("costOptions".equals(fieldName)) { + deserializedMigrationAssessmentSettings.costOptions = CostOptionSelectedValues.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMigrationAssessmentSettings; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationMode.java new file mode 100644 index 000000000000..c37511ce4aca --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationMode.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Mode/type of migration. + */ +public final class MigrationMode extends ExpandableStringEnum { + /** + * Migration based on log-shipping technology like LRS (Log Replay Service). + */ + public static final MigrationMode LOG_SHIPPING = fromString("LogShipping"); + + /** + * Migration using managed instance link (MILink) that utilizes Always On availability group technology. + */ + public static final MigrationMode MILINK = fromString("MILink"); + + /** + * Logical migration refers to moving data at the logical level (schema and rows) rather than transferring physical + * database files or backups. Examples include migrating to Azure SQL Database, which does not support physical + * restore. + */ + public static final MigrationMode LOGICAL = fromString("Logical"); + + /** + * Other mode of migration not listed currently. + */ + public static final MigrationMode OTHER = fromString("Other"); + + /** + * Mode of migration is not known. + */ + public static final MigrationMode UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of MigrationMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationMode() { + } + + /** + * Creates or finds a MigrationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationMode. + */ + public static MigrationMode fromString(String name) { + return fromString(name, MigrationMode.class); + } + + /** + * Gets known MigrationMode values. + * + * @return known MigrationMode values. + */ + public static Collection values() { + return values(MigrationMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationStatus.java new file mode 100644 index 000000000000..1eb4bd80597b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationStatus.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the migration job. + */ +public final class MigrationStatus extends ExpandableStringEnum { + /** + * NotStarted. + */ + public static final MigrationStatus NOT_STARTED = fromString("NotStarted"); + + /** + * InProgress. + */ + public static final MigrationStatus IN_PROGRESS = fromString("InProgress"); + + /** + * InProgressWithWarnings. + */ + public static final MigrationStatus IN_PROGRESS_WITH_WARNINGS = fromString("InProgressWithWarnings"); + + /** + * Cancelled. + */ + public static final MigrationStatus CANCELLED = fromString("Cancelled"); + + /** + * Failed. + */ + public static final MigrationStatus FAILED = fromString("Failed"); + + /** + * Successful. + */ + public static final MigrationStatus SUCCESSFUL = fromString("Successful"); + + /** + * Unknown. + */ + public static final MigrationStatus UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of MigrationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MigrationStatus() { + } + + /** + * Creates or finds a MigrationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MigrationStatus. + */ + public static MigrationStatus fromString(String name) { + return fromString(name, MigrationStatus.class); + } + + /** + * Gets known MigrationStatus values. + * + * @return known MigrationStatus values. + */ + public static Collection values() { + return values(MigrationStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Mode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Mode.java new file mode 100644 index 000000000000..85ec4d7ca415 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Mode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Mode of authentication in SqlServer. + */ +public final class Mode extends ExpandableStringEnum { + /** + * Mixed mode authentication for SQL Server which includes windows and SQL Authentication. + */ + public static final Mode MIXED = fromString("Mixed"); + + /** + * Windows Authentication for SQL Server. + */ + public static final Mode WINDOWS = fromString("Windows"); + + /** + * Used for scenarios were the mode cannot be determined. + */ + public static final Mode UNDEFINED = fromString("Undefined"); + + /** + * Creates a new instance of Mode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Mode() { + } + + /** + * Creates or finds a Mode from its string representation. + * + * @param name a name to look for. + * @return the corresponding Mode. + */ + public static Mode fromString(String name) { + return fromString(name, Mode.class); + } + + /** + * Gets known Mode values. + * + * @return known Mode values. + */ + public static Collection values() { + return values(Mode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java new file mode 100644 index 000000000000..ecdfe77a493f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The monitoring configuration. + */ +@Fluent +public final class Monitoring implements JsonSerializable { + /* + * Indicates if monitoring is enabled for this SQL Server instance. + */ + private Boolean enabled; + + /** + * Creates an instance of Monitoring class. + */ + public Monitoring() { + } + + /** + * Get the enabled property: Indicates if monitoring is enabled for this SQL Server instance. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates if monitoring is enabled for this SQL Server instance. + * + * @param enabled the enabled value to set. + * @return the Monitoring object itself. + */ + public Monitoring withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Monitoring from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Monitoring if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Monitoring. + */ + public static Monitoring fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Monitoring deserializedMonitoring = new Monitoring(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedMonitoring.enabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedMonitoring; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java index 43c18ce1ce49..baa551b584c2 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java @@ -1,18 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; -import java.util.Objects; -import java.util.UUID; /** * Properties from the Kubernetes data controller. @@ -22,7 +19,7 @@ public final class OnPremiseProperty implements JsonSerializable UUID.fromString(nonNullReader.getString())); + deserializedOnPremiseProperty.id = reader.getString(); } else if ("publicSigningKey".equals(fieldName)) { deserializedOnPremiseProperty.publicSigningKey = reader.getString(); } else if ("signingCertificateThumbprint".equals(fieldName)) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java index d0c0e0002183..aeed0ad3a0e2 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java index 94296bfe3d1a..84ba3f4508aa 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +14,7 @@ /** * Display metadata associated with the operation. */ -@Fluent +@Immutable public final class OperationDisplay implements JsonSerializable { /* * The localized friendly form of the resource provider name. @@ -40,7 +39,7 @@ public final class OperationDisplay implements JsonSerializable { /** - * Static value user for OperationOrigin. + * user. */ public static final OperationOrigin USER = fromString("user"); /** - * Static value system for OperationOrigin. + * system. */ public static final OperationOrigin SYSTEM = fromString("system"); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java index d512fcd0bd98..be672412c3c4 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java new file mode 100644 index 000000000000..446aba4d9245 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner; +import java.util.Map; + +/** + * An immutable client-side representation of PostgresInstance. + */ +public interface PostgresInstance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: null. + * + * @return the properties value. + */ + PostgresInstanceProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the sku property: Resource sku. + * + * @return the sku value. + */ + PostgresInstanceSku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner object. + * + * @return the inner object. + */ + PostgresInstanceInner innerModel(); + + /** + * The entirety of the PostgresInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The PostgresInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PostgresInstance definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the PostgresInstance definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the PostgresInstance definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the PostgresInstance definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + WithCreate withProperties(PostgresInstanceProperties properties); + } + + /** + * The stage of the PostgresInstance definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithExtendedLocation, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + PostgresInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PostgresInstance create(Context context); + } + + /** + * The stage of the PostgresInstance definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the PostgresInstance definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + + /** + * The stage of the PostgresInstance definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: Resource sku.. + * + * @param sku Resource sku. + * @return the next definition stage. + */ + WithCreate withSku(PostgresInstanceSku sku); + } + } + + /** + * Begins update for the PostgresInstance resource. + * + * @return the stage of resource update. + */ + PostgresInstance.Update update(); + + /** + * The template for PostgresInstance update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PostgresInstance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PostgresInstance apply(Context context); + } + + /** + * The PostgresInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the PostgresInstance update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the PostgresInstance update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Postgres Instance properties.. + * + * @param properties Postgres Instance properties. + * @return the next definition stage. + */ + Update withProperties(PostgresInstanceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PostgresInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PostgresInstance refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java new file mode 100644 index 000000000000..091a577ef51d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Postgres Instance properties. + */ +@Fluent +public final class PostgresInstanceProperties implements JsonSerializable { + /* + * The data controller id + */ + private String dataControllerId; + + /* + * The instance admin + */ + private String admin; + + /* + * Username and password for basic authentication. + */ + private BasicLoginInformation basicLoginInformation; + + /* + * The raw kubernetes information + */ + private Object k8SRaw; + + /* + * Last uploaded date from Kubernetes cluster. Defaults to current date time + */ + private OffsetDateTime lastUploadedDate; + + /* + * The provisioning state of the Azure Arc-enabled PostgreSQL instance. + */ + private String provisioningState; + + /** + * Creates an instance of PostgresInstanceProperties class. + */ + public PostgresInstanceProperties() { + } + + /** + * Get the dataControllerId property: The data controller id. + * + * @return the dataControllerId value. + */ + public String dataControllerId() { + return this.dataControllerId; + } + + /** + * Set the dataControllerId property: The data controller id. + * + * @param dataControllerId the dataControllerId value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withDataControllerId(String dataControllerId) { + this.dataControllerId = dataControllerId; + return this; + } + + /** + * Get the admin property: The instance admin. + * + * @return the admin value. + */ + public String admin() { + return this.admin; + } + + /** + * Set the admin property: The instance admin. + * + * @param admin the admin value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withAdmin(String admin) { + this.admin = admin; + return this; + } + + /** + * Get the basicLoginInformation property: Username and password for basic authentication. + * + * @return the basicLoginInformation value. + */ + public BasicLoginInformation basicLoginInformation() { + return this.basicLoginInformation; + } + + /** + * Set the basicLoginInformation property: Username and password for basic authentication. + * + * @param basicLoginInformation the basicLoginInformation value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withBasicLoginInformation(BasicLoginInformation basicLoginInformation) { + this.basicLoginInformation = basicLoginInformation; + return this; + } + + /** + * Get the k8SRaw property: The raw kubernetes information. + * + * @return the k8SRaw value. + */ + public Object k8SRaw() { + return this.k8SRaw; + } + + /** + * Set the k8SRaw property: The raw kubernetes information. + * + * @param k8SRaw the k8SRaw value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withK8SRaw(Object k8SRaw) { + this.k8SRaw = k8SRaw; + return this; + } + + /** + * Get the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. + * + * @return the lastUploadedDate value. + */ + public OffsetDateTime lastUploadedDate() { + return this.lastUploadedDate; + } + + /** + * Set the lastUploadedDate property: Last uploaded date from Kubernetes cluster. Defaults to current date time. + * + * @param lastUploadedDate the lastUploadedDate value to set. + * @return the PostgresInstanceProperties object itself. + */ + public PostgresInstanceProperties withLastUploadedDate(OffsetDateTime lastUploadedDate) { + this.lastUploadedDate = lastUploadedDate; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Azure Arc-enabled PostgreSQL instance. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dataControllerId", this.dataControllerId); + jsonWriter.writeStringField("admin", this.admin); + jsonWriter.writeJsonField("basicLoginInformation", this.basicLoginInformation); + if (this.k8SRaw != null) { + jsonWriter.writeUntypedField("k8sRaw", this.k8SRaw); + } + jsonWriter.writeStringField("lastUploadedDate", + this.lastUploadedDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUploadedDate)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PostgresInstanceProperties. + */ + public static PostgresInstanceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceProperties deserializedPostgresInstanceProperties = new PostgresInstanceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataControllerId".equals(fieldName)) { + deserializedPostgresInstanceProperties.dataControllerId = reader.getString(); + } else if ("admin".equals(fieldName)) { + deserializedPostgresInstanceProperties.admin = reader.getString(); + } else if ("basicLoginInformation".equals(fieldName)) { + deserializedPostgresInstanceProperties.basicLoginInformation + = BasicLoginInformation.fromJson(reader); + } else if ("k8sRaw".equals(fieldName)) { + deserializedPostgresInstanceProperties.k8SRaw = reader.readUntyped(); + } else if ("lastUploadedDate".equals(fieldName)) { + deserializedPostgresInstanceProperties.lastUploadedDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedPostgresInstanceProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java new file mode 100644 index 000000000000..fcdfd8d3345c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource model definition representing SKU for Azure Database for PostgresSQL - Azure Arc. + */ +@Fluent +public final class PostgresInstanceSku extends CommonSku { + /* + * This field is required to be implemented by the Resource Provider if the service has more than one tier. + */ + private PostgresInstanceSkuTier tier; + + /** + * Creates an instance of PostgresInstanceSku class. + */ + public PostgresInstanceSku() { + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier. + * + * @return the tier value. + */ + public PostgresInstanceSkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier. + * + * @param tier the tier value to set. + * @return the PostgresInstanceSku object itself. + */ + public PostgresInstanceSku withTier(PostgresInstanceSkuTier tier) { + this.tier = tier; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withDev(Boolean dev) { + super.withDev(dev); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withSize(String size) { + super.withSize(size); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withFamily(String family) { + super.withFamily(family); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PostgresInstanceSku withCapacity(Integer capacity) { + super.withCapacity(capacity); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeBooleanField("dev", dev()); + jsonWriter.writeStringField("size", size()); + jsonWriter.writeStringField("family", family()); + jsonWriter.writeNumberField("capacity", capacity()); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceSku if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PostgresInstanceSku. + */ + public static PostgresInstanceSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceSku deserializedPostgresInstanceSku = new PostgresInstanceSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPostgresInstanceSku.withName(reader.getString()); + } else if ("dev".equals(fieldName)) { + deserializedPostgresInstanceSku.withDev(reader.getNullable(JsonReader::getBoolean)); + } else if ("size".equals(fieldName)) { + deserializedPostgresInstanceSku.withSize(reader.getString()); + } else if ("family".equals(fieldName)) { + deserializedPostgresInstanceSku.withFamily(reader.getString()); + } else if ("capacity".equals(fieldName)) { + deserializedPostgresInstanceSku.withCapacity(reader.getNullable(JsonReader::getInt)); + } else if ("tier".equals(fieldName)) { + deserializedPostgresInstanceSku.tier = PostgresInstanceSkuTier.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java new file mode 100644 index 000000000000..aee18bc32b7f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Defines values for PostgresInstanceSkuTier. + */ +public enum PostgresInstanceSkuTier { + /** + * Enum value Hyperscale. + */ + HYPERSCALE("Hyperscale"); + + /** + * The actual serialized value for a PostgresInstanceSkuTier instance. + */ + private final String value; + + PostgresInstanceSkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PostgresInstanceSkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed PostgresInstanceSkuTier object, or null if unable to parse. + */ + public static PostgresInstanceSkuTier fromString(String value) { + if (value == null) { + return null; + } + PostgresInstanceSkuTier[] items = PostgresInstanceSkuTier.values(); + for (PostgresInstanceSkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java new file mode 100644 index 000000000000..34a7e8846965 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to a Postgres Instance. + */ +@Fluent +public final class PostgresInstanceUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * Postgres Instance properties. + */ + private PostgresInstanceProperties properties; + + /** + * Creates an instance of PostgresInstanceUpdate class. + */ + public PostgresInstanceUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PostgresInstanceUpdate object itself. + */ + public PostgresInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Postgres Instance properties. + * + * @return the properties value. + */ + public PostgresInstanceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Postgres Instance properties. + * + * @param properties the properties value to set. + * @return the PostgresInstanceUpdate object itself. + */ + public PostgresInstanceUpdate withProperties(PostgresInstanceProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostgresInstanceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostgresInstanceUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PostgresInstanceUpdate. + */ + public static PostgresInstanceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostgresInstanceUpdate deserializedPostgresInstanceUpdate = new PostgresInstanceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPostgresInstanceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedPostgresInstanceUpdate.properties = PostgresInstanceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPostgresInstanceUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java new file mode 100644 index 000000000000..d9a78dac7eaa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of PostgresInstances. + */ +public interface PostgresInstances { + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String postgresInstanceName, + Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance. + */ + PostgresInstance getByResourceGroup(String resourceGroupName, String postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String postgresInstanceName); + + /** + * Deletes a postgres Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param postgresInstanceName Name of Postgres Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String postgresInstanceName, Context context); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List postgres Instance resources in the resource group + * + * Get a postgres Instances list by Resource group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List postgres Instance resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List postgres Instance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgresInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Retrieves a postgres Instance resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + PostgresInstance getById(String id); + + /** + * Retrieves a postgres Instance resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Postgres Instance along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a postgres Instance resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a postgres Instance resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PostgresInstance resource. + * + * @param name resource name. + * @return the first stage of the new PostgresInstance definition. + */ + PostgresInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.java new file mode 100644 index 000000000000..964784e14c6e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Whether the primary replica should allow all connections or only READ_WRITE connections (disallowing ReadOnly + * connections). + */ +public enum PrimaryAllowConnections { + /** + * ALL. + */ + ALL("ALL"), + + /** + * READ_WRITE. + */ + READ_WRITE("READ_WRITE"); + + /** + * The actual serialized value for a PrimaryAllowConnections instance. + */ + private final String value; + + PrimaryAllowConnections(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PrimaryAllowConnections instance. + * + * @param value the serialized value to parse. + * @return the parsed PrimaryAllowConnections object, or null if unable to parse. + */ + public static PrimaryAllowConnections fromString(String value) { + if (value == null) { + return null; + } + PrimaryAllowConnections[] items = PrimaryAllowConnections.values(); + for (PrimaryAllowConnections item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java new file mode 100644 index 000000000000..3f1024d4c3b1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the failover group resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Succeeded. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java new file mode 100644 index 000000000000..9bf7fa16d36a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The target recommendation Status for this database. + */ +public final class RecommendationStatus extends ExpandableStringEnum { + /** + * NotReady. + */ + public static final RecommendationStatus NOT_READY = fromString("NotReady"); + + /** + * Ready. + */ + public static final RecommendationStatus READY = fromString("Ready"); + + /** + * ReadyWithConditions. + */ + public static final RecommendationStatus READY_WITH_CONDITIONS = fromString("ReadyWithConditions"); + + /** + * Unknown. + */ + public static final RecommendationStatus UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of RecommendationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecommendationStatus() { + } + + /** + * Creates or finds a RecommendationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationStatus. + */ + public static RecommendationStatus fromString(String name) { + return fromString(name, RecommendationStatus.class); + } + + /** + * Gets known RecommendationStatus values. + * + * @return known RecommendationStatus values. + */ + public static Collection values() { + return values(RecommendationStatus.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java new file mode 100644 index 000000000000..b65e27d7cd79 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the database. + */ +public final class RecoveryMode extends ExpandableStringEnum { + /** + * Full. + */ + public static final RecoveryMode FULL = fromString("Full"); + + /** + * Bulk-logged. + */ + public static final RecoveryMode BULK_LOGGED = fromString("Bulk-logged"); + + /** + * Simple. + */ + public static final RecoveryMode SIMPLE = fromString("Simple"); + + /** + * Creates a new instance of RecoveryMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecoveryMode() { + } + + /** + * Creates or finds a RecoveryMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecoveryMode. + */ + public static RecoveryMode fromString(String name) { + return fromString(name, RecoveryMode.class); + } + + /** + * Gets known RecoveryMode values. + * + * @return known RecoveryMode values. + */ + public static Collection values() { + return values(RecoveryMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java new file mode 100644 index 000000000000..92e083035fcf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Defines values for ReplicationPartnerType. + */ +public enum ReplicationPartnerType { + /** + * SQLServer. + */ + SQLSERVER("SQLServer"), + + /** + * AzureSQLVM. + */ + AZURE_SQLVM("AzureSQLVM"), + + /** + * AzureSQLManagedInstance. + */ + AZURE_SQLMANAGED_INSTANCE("AzureSQLManagedInstance"), + + /** + * Unknown. + */ + UNKNOWN("Unknown"); + + /** + * The actual serialized value for a ReplicationPartnerType instance. + */ + private final String value; + + ReplicationPartnerType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReplicationPartnerType instance. + * + * @param value the serialized value to parse. + * @return the parsed ReplicationPartnerType object, or null if unable to parse. + */ + public static ReplicationPartnerType fromString(String value) { + if (value == null) { + return null; + } + ReplicationPartnerType[] items = ReplicationPartnerType.values(); + for (ReplicationPartnerType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ResourceUpdateMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ResourceUpdateMode.java new file mode 100644 index 000000000000..2f3541e2e3e6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ResourceUpdateMode.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Controls whether the SQL Server instance resource is updated with the target recommendation details after the job + * completes. + */ +public final class ResourceUpdateMode extends ExpandableStringEnum { + /** + * Update the SQL Server instance resource with all target recommendation details, including SKU recommendations and + * cost estimates, upon job completion. + */ + public static final ResourceUpdateMode UPDATE_ALL_TARGET_RECOMMENDATION_DETAILS + = fromString("UpdateAllTargetRecommendationDetails"); + + /** + * Do not update the SQL Server instance resource. The target recommendation results will only be available via the + * GetTargetRecommendationReports API. + */ + public static final ResourceUpdateMode SKIP_RESOURCE_UPDATE = fromString("SkipResourceUpdate"); + + /** + * Creates a new instance of ResourceUpdateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceUpdateMode() { + } + + /** + * Creates or finds a ResourceUpdateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceUpdateMode. + */ + public static ResourceUpdateMode fromString(String name) { + return fromString(name, ResourceUpdateMode.class); + } + + /** + * Gets known ResourceUpdateMode values. + * + * @return known ResourceUpdateMode values. + */ + public static Collection values() { + return values(ResourceUpdateMode.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java new file mode 100644 index 000000000000..6456a271a804 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The result of the sequencer action. + */ +public final class Result extends ExpandableStringEnum { + /** + * NotCompleted. + */ + public static final Result NOT_COMPLETED = fromString("NotCompleted"); + + /** + * Succeeded. + */ + public static final Result SUCCEEDED = fromString("Succeeded"); + + /** + * Failed. + */ + public static final Result FAILED = fromString("Failed"); + + /** + * TimedOut. + */ + public static final Result TIMED_OUT = fromString("TimedOut"); + + /** + * Skipped. + */ + public static final Result SKIPPED = fromString("Skipped"); + + /** + * Creates a new instance of Result value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Result() { + } + + /** + * Creates or finds a Result from its string representation. + * + * @param name a name to look for. + * @return the corresponding Result. + */ + public static Result fromString(String name) { + return fromString(name, Result.class); + } + + /** + * Gets known Result values. + * + * @return known Result values. + */ + public static Collection values() { + return values(Result.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java new file mode 100644 index 000000000000..2506c2a0b632 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Mirroring Role. + */ +public final class Role extends ExpandableStringEnum { + /** + * NONE. + */ + public static final Role NONE = fromString("NONE"); + + /** + * PARTNER. + */ + public static final Role PARTNER = fromString("PARTNER"); + + /** + * WITNESS. + */ + public static final Role WITNESS = fromString("WITNESS"); + + /** + * ALL. + */ + public static final Role ALL = fromString("ALL"); + + /** + * Creates a new instance of Role value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Role() { + } + + /** + * Creates or finds a Role from its string representation. + * + * @param name a name to look for. + * @return the corresponding Role. + */ + public static Role fromString(String name) { + return fromString(name, Role.class); + } + + /** + * Gets known Role values. + * + * @return known Role values. + */ + public static Collection values() { + return values(Role.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Schedule.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Schedule.java new file mode 100644 index 000000000000..95f42674f180 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Schedule.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The scheduling configuration. + */ +@Fluent +public final class Schedule implements JsonSerializable { + /* + * Indicates whether scheduling is enabled. + */ + private Boolean enabled; + + /* + * The cron trigger configuration. + */ + private CronTrigger cronTrigger; + + /** + * Creates an instance of Schedule class. + */ + public Schedule() { + } + + /** + * Get the enabled property: Indicates whether scheduling is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether scheduling is enabled. + * + * @param enabled the enabled value to set. + * @return the Schedule object itself. + */ + public Schedule withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the cronTrigger property: The cron trigger configuration. + * + * @return the cronTrigger value. + */ + public CronTrigger cronTrigger() { + return this.cronTrigger; + } + + /** + * Set the cronTrigger property: The cron trigger configuration. + * + * @param cronTrigger the cronTrigger value to set. + * @return the Schedule object itself. + */ + public Schedule withCronTrigger(CronTrigger cronTrigger) { + this.cronTrigger = cronTrigger; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeJsonField("cronTrigger", this.cronTrigger); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Schedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Schedule if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Schedule. + */ + public static Schedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Schedule deserializedSchedule = new Schedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedSchedule.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("cronTrigger".equals(fieldName)) { + deserializedSchedule.cronTrigger = CronTrigger.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSchedule; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java new file mode 100644 index 000000000000..b4654ca34942 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Azure scope to which the license will apply. + */ +public final class ScopeType extends ExpandableStringEnum { + /** + * Tenant. + */ + public static final ScopeType TENANT = fromString("Tenant"); + + /** + * Subscription. + */ + public static final ScopeType SUBSCRIPTION = fromString("Subscription"); + + /** + * ResourceGroup. + */ + public static final ScopeType RESOURCE_GROUP = fromString("ResourceGroup"); + + /** + * Creates a new instance of ScopeType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScopeType() { + } + + /** + * Creates or finds a ScopeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScopeType. + */ + public static ScopeType fromString(String name) { + return fromString(name, ScopeType.class); + } + + /** + * Gets known ScopeType values. + * + * @return known ScopeType values. + */ + public static Collection values() { + return values(ScopeType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java new file mode 100644 index 000000000000..ebf0ee5a2b06 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Whether the secondary replica should allow all connections, no connections, or only ReadOnly connections. + */ +public enum SecondaryAllowConnections { + /** + * NO. + */ + NO("NO"), + + /** + * ALL. + */ + ALL("ALL"), + + /** + * READ_ONLY. + */ + READ_ONLY("READ_ONLY"); + + /** + * The actual serialized value for a SecondaryAllowConnections instance. + */ + private final String value; + + SecondaryAllowConnections(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecondaryAllowConnections instance. + * + * @param value the serialized value to parse. + * @return the parsed SecondaryAllowConnections object, or null if unable to parse. + */ + public static SecondaryAllowConnections fromString(String value) { + if (value == null) { + return null; + } + SecondaryAllowConnections[] items = SecondaryAllowConnections.values(); + for (SecondaryAllowConnections item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java new file mode 100644 index 000000000000..6c06bb775273 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +/** + * Specifies how the secondary replica will be initially seeded. AUTOMATIC enables direct seeding. This method will seed + * the secondary replica over the network. This method does not require you to backup and restore a copy of the primary + * database on the replica. MANUAL specifies manual seeding (default). This method requires you to create a backup of + * the database on the primary replica and manually restore that backup on the secondary replica. + */ +public enum SeedingMode { + /** + * AUTOMATIC. + */ + AUTOMATIC("AUTOMATIC"), + + /** + * MANUAL. + */ + MANUAL("MANUAL"); + + /** + * The actual serialized value for a SeedingMode instance. + */ + private final String value; + + SeedingMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SeedingMode instance. + * + * @param value the serialized value to parse. + * @return the parsed SeedingMode object, or null if unable to parse. + */ + public static SeedingMode fromString(String value) { + if (value == null) { + return null; + } + SeedingMode[] items = SeedingMode.values(); + for (SeedingMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java new file mode 100644 index 000000000000..6afdebe777c6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The sequencer action details. + */ +@Immutable +public final class SequencerAction implements JsonSerializable { + /* + * The unique identifier of the sequencer action. + */ + private String actionId; + + /* + * The state of the sequencer action. + */ + private SequencerState state; + + /* + * The result of the sequencer action. + */ + private Result result; + + /** + * Creates an instance of SequencerAction class. + */ + private SequencerAction() { + } + + /** + * Get the actionId property: The unique identifier of the sequencer action. + * + * @return the actionId value. + */ + public String actionId() { + return this.actionId; + } + + /** + * Get the state property: The state of the sequencer action. + * + * @return the state value. + */ + public SequencerState state() { + return this.state; + } + + /** + * Get the result property: The result of the sequencer action. + * + * @return the result value. + */ + public Result result() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionId", this.actionId); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("result", this.result == null ? null : this.result.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SequencerAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SequencerAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SequencerAction. + */ + public static SequencerAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SequencerAction deserializedSequencerAction = new SequencerAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionId".equals(fieldName)) { + deserializedSequencerAction.actionId = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedSequencerAction.state = SequencerState.fromString(reader.getString()); + } else if ("result".equals(fieldName)) { + deserializedSequencerAction.result = Result.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSequencerAction; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java new file mode 100644 index 000000000000..964631c23f11 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the sequencer action. + */ +public final class SequencerState extends ExpandableStringEnum { + /** + * NotStarted. + */ + public static final SequencerState NOT_STARTED = fromString("NotStarted"); + + /** + * WaitingPredecessors. + */ + public static final SequencerState WAITING_PREDECESSORS = fromString("WaitingPredecessors"); + + /** + * ExecutingAction. + */ + public static final SequencerState EXECUTING_ACTION = fromString("ExecutingAction"); + + /** + * CreatingSuccessors. + */ + public static final SequencerState CREATING_SUCCESSORS = fromString("CreatingSuccessors"); + + /** + * Completed. + */ + public static final SequencerState COMPLETED = fromString("Completed"); + + /** + * Creates a new instance of SequencerState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SequencerState() { + } + + /** + * Creates or finds a SequencerState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SequencerState. + */ + public static SequencerState fromString(String name) { + return fromString(name, SequencerState.class); + } + + /** + * Gets known SequencerState values. + * + * @return known SequencerState values. + */ + public static Collection values() { + return values(SequencerState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java new file mode 100644 index 000000000000..1cab39abc2de --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The ServerAssessmentsItem model. + */ +@Immutable +public final class ServerAssessmentsItem implements JsonSerializable { + /* + * The appliesToMigrationTargetPlatform property. + */ + private String appliesToMigrationTargetPlatform; + + /* + * The featureId property. + */ + private String featureId; + + /* + * The impactedObjects property. + */ + private List impactedObjects; + + /* + * The issueCategory property. + */ + private String issueCategory; + + /* + * The moreInformation property. + */ + private String moreInformation; + + /** + * Creates an instance of ServerAssessmentsItem class. + */ + private ServerAssessmentsItem() { + } + + /** + * Get the appliesToMigrationTargetPlatform property: The appliesToMigrationTargetPlatform property. + * + * @return the appliesToMigrationTargetPlatform value. + */ + public String appliesToMigrationTargetPlatform() { + return this.appliesToMigrationTargetPlatform; + } + + /** + * Get the featureId property: The featureId property. + * + * @return the featureId value. + */ + public String featureId() { + return this.featureId; + } + + /** + * Get the impactedObjects property: The impactedObjects property. + * + * @return the impactedObjects value. + */ + public List impactedObjects() { + return this.impactedObjects; + } + + /** + * Get the issueCategory property: The issueCategory property. + * + * @return the issueCategory value. + */ + public String issueCategory() { + return this.issueCategory; + } + + /** + * Get the moreInformation property: The moreInformation property. + * + * @return the moreInformation value. + */ + public String moreInformation() { + return this.moreInformation; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("appliesToMigrationTargetPlatform", this.appliesToMigrationTargetPlatform); + jsonWriter.writeStringField("featureId", this.featureId); + jsonWriter.writeArrayField("impactedObjects", this.impactedObjects, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("issueCategory", this.issueCategory); + jsonWriter.writeStringField("moreInformation", this.moreInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAssessmentsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAssessmentsItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerAssessmentsItem. + */ + public static ServerAssessmentsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAssessmentsItem deserializedServerAssessmentsItem = new ServerAssessmentsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("appliesToMigrationTargetPlatform".equals(fieldName)) { + deserializedServerAssessmentsItem.appliesToMigrationTargetPlatform = reader.getString(); + } else if ("featureId".equals(fieldName)) { + deserializedServerAssessmentsItem.featureId = reader.getString(); + } else if ("impactedObjects".equals(fieldName)) { + List impactedObjects + = reader.readArray(reader1 -> ServerAssessmentsPropertiesItemsItem.fromJson(reader1)); + deserializedServerAssessmentsItem.impactedObjects = impactedObjects; + } else if ("issueCategory".equals(fieldName)) { + deserializedServerAssessmentsItem.issueCategory = reader.getString(); + } else if ("moreInformation".equals(fieldName)) { + deserializedServerAssessmentsItem.moreInformation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerAssessmentsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java new file mode 100644 index 000000000000..40c33b33d361 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ServerAssessmentsPropertiesItemsItem model. + */ +@Immutable +public final class ServerAssessmentsPropertiesItemsItem + implements JsonSerializable { + /* + * The impactDetail property. + */ + private String impactDetail; + + /* + * The name property. + */ + private String name; + + /* + * The objectType property. + */ + private String objectType; + + /** + * Creates an instance of ServerAssessmentsPropertiesItemsItem class. + */ + private ServerAssessmentsPropertiesItemsItem() { + } + + /** + * Get the impactDetail property: The impactDetail property. + * + * @return the impactDetail value. + */ + public String impactDetail() { + return this.impactDetail; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the objectType property: The objectType property. + * + * @return the objectType value. + */ + public String objectType() { + return this.objectType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("impactDetail", this.impactDetail); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("objectType", this.objectType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAssessmentsPropertiesItemsItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAssessmentsPropertiesItemsItem if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerAssessmentsPropertiesItemsItem. + */ + public static ServerAssessmentsPropertiesItemsItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAssessmentsPropertiesItemsItem deserializedServerAssessmentsPropertiesItemsItem + = new ServerAssessmentsPropertiesItemsItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("impactDetail".equals(fieldName)) { + deserializedServerAssessmentsPropertiesItemsItem.impactDetail = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerAssessmentsPropertiesItemsItem.name = reader.getString(); + } else if ("objectType".equals(fieldName)) { + deserializedServerAssessmentsPropertiesItemsItem.objectType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerAssessmentsPropertiesItemsItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java new file mode 100644 index 000000000000..7ad4167818c7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Indicates if the resource represents a SQL Server engine or a SQL Server component service installed on the host. + */ +public final class ServiceType extends ExpandableStringEnum { + /** + * SQL Server Database Services. + */ + public static final ServiceType ENGINE = fromString("Engine"); + + /** + * SQL Server Reporting Services. + */ + public static final ServiceType SSRS = fromString("SSRS"); + + /** + * SQL Server Analysis Services. + */ + public static final ServiceType SSAS = fromString("SSAS"); + + /** + * SQL Server Integration Services. + */ + public static final ServiceType SSIS = fromString("SSIS"); + + /** + * Power BI Report Server. + */ + public static final ServiceType PBIRS = fromString("PBIRS"); + + /** + * Creates a new instance of ServiceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServiceType() { + } + + /** + * Creates or finds a ServiceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceType. + */ + public static ServiceType fromString(String name) { + return fromString(name, ServiceType.class); + } + + /** + * Gets known ServiceType values. + * + * @return known ServiceType values. + */ + public static Collection values() { + return values(ServiceType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java new file mode 100644 index 000000000000..a23b03c8d177 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * SKU Recommendation results for Azure migration targets for SQL Server. + */ +@Immutable +public final class SkuRecommendationResults implements JsonSerializable { + /* + * SKU Recommendation results for Azure SQL Database. + */ + private SkuRecommendationResultsAzureSqlDatabase azureSqlDatabase; + + /* + * SKU Recommendation results for Azure SQL Managed Instance. + */ + private SkuRecommendationResultsAzureSqlManagedInstance azureSqlManagedInstance; + + /* + * SKU Recommendation results for Azure SQL Virtual Machine. + */ + private SkuRecommendationResultsAzureSqlVirtualMachine azureSqlVirtualMachine; + + /** + * Creates an instance of SkuRecommendationResults class. + */ + private SkuRecommendationResults() { + } + + /** + * Get the azureSqlDatabase property: SKU Recommendation results for Azure SQL Database. + * + * @return the azureSqlDatabase value. + */ + public SkuRecommendationResultsAzureSqlDatabase azureSqlDatabase() { + return this.azureSqlDatabase; + } + + /** + * Get the azureSqlManagedInstance property: SKU Recommendation results for Azure SQL Managed Instance. + * + * @return the azureSqlManagedInstance value. + */ + public SkuRecommendationResultsAzureSqlManagedInstance azureSqlManagedInstance() { + return this.azureSqlManagedInstance; + } + + /** + * Get the azureSqlVirtualMachine property: SKU Recommendation results for Azure SQL Virtual Machine. + * + * @return the azureSqlVirtualMachine value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachine azureSqlVirtualMachine() { + return this.azureSqlVirtualMachine; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("azureSqlDatabase", this.azureSqlDatabase); + jsonWriter.writeJsonField("azureSqlManagedInstance", this.azureSqlManagedInstance); + jsonWriter.writeJsonField("azureSqlVirtualMachine", this.azureSqlVirtualMachine); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResults from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResults if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResults. + */ + public static SkuRecommendationResults fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResults deserializedSkuRecommendationResults = new SkuRecommendationResults(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureSqlDatabase".equals(fieldName)) { + deserializedSkuRecommendationResults.azureSqlDatabase + = SkuRecommendationResultsAzureSqlDatabase.fromJson(reader); + } else if ("azureSqlManagedInstance".equals(fieldName)) { + deserializedSkuRecommendationResults.azureSqlManagedInstance + = SkuRecommendationResultsAzureSqlManagedInstance.fromJson(reader); + } else if ("azureSqlVirtualMachine".equals(fieldName)) { + deserializedSkuRecommendationResults.azureSqlVirtualMachine + = SkuRecommendationResultsAzureSqlVirtualMachine.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResults; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.java new file mode 100644 index 000000000000..ed17eb28fd67 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * SKU Recommendation results for Azure SQL Database. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlDatabase + implements JsonSerializable { + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * Number of blocker issues to fix before migrating to the target platform. + */ + private Integer numberOfServerBlockerIssues; + + /* + * The monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The monthly cost for all different savings options applicable for the particular SKU. + */ + private List monthlyCostOptions; + + /* + * The targetSku property. + */ + private SkuRecommendationResultsAzureSqlDatabaseTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlDatabase class. + */ + private SkuRecommendationResultsAzureSqlDatabase() { + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Get the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @return the numberOfServerBlockerIssues value. + */ + public Integer numberOfServerBlockerIssues() { + return this.numberOfServerBlockerIssues; + } + + /** + * Get the monthlyCost property: The monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Get the monthlyCostOptions property: The monthly cost for all different savings options applicable for the + * particular SKU. + * + * @return the monthlyCostOptions value. + */ + public List monthlyCostOptions() { + return this.monthlyCostOptions; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSku targetSku() { + return this.targetSku; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeNumberField("numberOfServerBlockerIssues", this.numberOfServerBlockerIssues); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlDatabase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlDatabase if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlDatabase. + */ + public static SkuRecommendationResultsAzureSqlDatabase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlDatabase deserializedSkuRecommendationResultsAzureSqlDatabase + = new SkuRecommendationResultsAzureSqlDatabase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("numberOfServerBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.numberOfServerBlockerIssues + = reader.getNullable(JsonReader::getInt); + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("monthlyCostOptions".equals(fieldName)) { + List monthlyCostOptions + = reader.readArray(reader1 -> SkuRecommendationResultsMonthlyCostOptionItem.fromJson(reader1)); + deserializedSkuRecommendationResultsAzureSqlDatabase.monthlyCostOptions = monthlyCostOptions; + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabase.targetSku + = SkuRecommendationResultsAzureSqlDatabaseTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlDatabase; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java new file mode 100644 index 000000000000..58133320d67e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlDatabaseTargetSku model. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlDatabaseTargetSku + implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory category; + + /* + * Compute Size in vCores. + */ + private Integer computeSize; + + /* + * maximum storage for this particular SKU, in MB. + */ + private Double storageMaxSizeInMb; + + /* + * The predicted data size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedDataSizeInMb; + + /* + * The predicted log size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedLogSizeInMb; + + /* + * The maximum storage IOPS in Azure SQL, will impact the billing cost. + */ + private Double maxStorageIops; + + /* + * The maximum throughput in Azure SQL, will impact the billing cost. + */ + private Double maxThroughputMBps; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSku class. + */ + private SkuRecommendationResultsAzureSqlDatabaseTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory category() { + return this.category; + } + + /** + * Get the computeSize property: Compute Size in vCores. + * + * @return the computeSize value. + */ + public Integer computeSize() { + return this.computeSize; + } + + /** + * Get the storageMaxSizeInMb property: maximum storage for this particular SKU, in MB. + * + * @return the storageMaxSizeInMb value. + */ + public Double storageMaxSizeInMb() { + return this.storageMaxSizeInMb; + } + + /** + * Get the predictedDataSizeInMb property: The predicted data size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedDataSizeInMb value. + */ + public Double predictedDataSizeInMb() { + return this.predictedDataSizeInMb; + } + + /** + * Get the predictedLogSizeInMb property: The predicted log size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedLogSizeInMb value. + */ + public Double predictedLogSizeInMb() { + return this.predictedLogSizeInMb; + } + + /** + * Get the maxStorageIops property: The maximum storage IOPS in Azure SQL, will impact the billing cost. + * + * @return the maxStorageIops value. + */ + public Double maxStorageIops() { + return this.maxStorageIops; + } + + /** + * Get the maxThroughputMBps property: The maximum throughput in Azure SQL, will impact the billing cost. + * + * @return the maxThroughputMBps value. + */ + public Double maxThroughputMBps() { + return this.maxThroughputMBps; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + jsonWriter.writeNumberField("computeSize", this.computeSize); + jsonWriter.writeNumberField("storageMaxSizeInMb", this.storageMaxSizeInMb); + jsonWriter.writeNumberField("predictedDataSizeInMb", this.predictedDataSizeInMb); + jsonWriter.writeNumberField("predictedLogSizeInMb", this.predictedLogSizeInMb); + jsonWriter.writeNumberField("maxStorageIops", this.maxStorageIops); + jsonWriter.writeNumberField("maxThroughputMBps", this.maxThroughputMBps); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlDatabaseTargetSku if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlDatabaseTargetSku. + */ + public static SkuRecommendationResultsAzureSqlDatabaseTargetSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlDatabaseTargetSku deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku + = new SkuRecommendationResultsAzureSqlDatabaseTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.category + = SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.fromJson(reader); + } else if ("computeSize".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.computeSize + = reader.getNullable(JsonReader::getInt); + } else if ("storageMaxSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.storageMaxSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedDataSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.predictedDataSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedLogSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.predictedLogSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("maxStorageIops".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.maxStorageIops + = reader.getNullable(JsonReader::getDouble); + } else if ("maxThroughputMBps".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku.maxThroughputMBps + = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java new file mode 100644 index 000000000000..916e9b72b877 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory model. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory + implements JsonSerializable { + /* + * The compute tier of the target SKU. + */ + private String computeTier; + + /* + * The hardware type of the target SKU. + */ + private String hardwareType; + + /* + * The SQL purchasing model of the target SKU. + */ + private String sqlPurchasingModel; + + /* + * The SQL service tier of the target SKU. + */ + private String sqlServiceTier; + + /* + * Indicates if zone redundancy is available for the target SKU. + */ + private Boolean zoneRedundancyAvailable; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory class. + */ + private SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory() { + } + + /** + * Get the computeTier property: The compute tier of the target SKU. + * + * @return the computeTier value. + */ + public String computeTier() { + return this.computeTier; + } + + /** + * Get the hardwareType property: The hardware type of the target SKU. + * + * @return the hardwareType value. + */ + public String hardwareType() { + return this.hardwareType; + } + + /** + * Get the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @return the sqlPurchasingModel value. + */ + public String sqlPurchasingModel() { + return this.sqlPurchasingModel; + } + + /** + * Get the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @return the sqlServiceTier value. + */ + public String sqlServiceTier() { + return this.sqlServiceTier; + } + + /** + * Get the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @return the zoneRedundancyAvailable value. + */ + public Boolean zoneRedundancyAvailable() { + return this.zoneRedundancyAvailable; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computeTier", this.computeTier); + jsonWriter.writeStringField("hardwareType", this.hardwareType); + jsonWriter.writeStringField("sqlPurchasingModel", this.sqlPurchasingModel); + jsonWriter.writeStringField("sqlServiceTier", this.sqlServiceTier); + jsonWriter.writeBooleanField("zoneRedundancyAvailable", this.zoneRedundancyAvailable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory. + */ + public static SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory + = new SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.computeTier + = reader.getString(); + } else if ("hardwareType".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.hardwareType + = reader.getString(); + } else if ("sqlPurchasingModel".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.sqlPurchasingModel + = reader.getString(); + } else if ("sqlServiceTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.sqlServiceTier + = reader.getString(); + } else if ("zoneRedundancyAvailable".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.zoneRedundancyAvailable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java new file mode 100644 index 000000000000..c152eabb9918 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * SKU Recommendation results for Azure SQL Managed Instance. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlManagedInstance + implements JsonSerializable { + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * Number of blocker issues to fix before migrating to the target platform. + */ + private Integer numberOfServerBlockerIssues; + + /* + * The monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The monthly cost for all different savings options applicable for the particular SKU. + */ + private List monthlyCostOptions; + + /* + * The targetSku property. + */ + private SkuRecommendationResultsAzureSqlManagedInstanceTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlManagedInstance class. + */ + private SkuRecommendationResultsAzureSqlManagedInstance() { + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Get the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @return the numberOfServerBlockerIssues value. + */ + public Integer numberOfServerBlockerIssues() { + return this.numberOfServerBlockerIssues; + } + + /** + * Get the monthlyCost property: The monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Get the monthlyCostOptions property: The monthly cost for all different savings options applicable for the + * particular SKU. + * + * @return the monthlyCostOptions value. + */ + public List monthlyCostOptions() { + return this.monthlyCostOptions; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSku targetSku() { + return this.targetSku; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeNumberField("numberOfServerBlockerIssues", this.numberOfServerBlockerIssues); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlManagedInstance from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlManagedInstance if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlManagedInstance. + */ + public static SkuRecommendationResultsAzureSqlManagedInstance fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlManagedInstance deserializedSkuRecommendationResultsAzureSqlManagedInstance + = new SkuRecommendationResultsAzureSqlManagedInstance(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("numberOfServerBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.numberOfServerBlockerIssues + = reader.getNullable(JsonReader::getInt); + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("monthlyCostOptions".equals(fieldName)) { + List monthlyCostOptions + = reader.readArray(reader1 -> SkuRecommendationResultsMonthlyCostOptionItem.fromJson(reader1)); + deserializedSkuRecommendationResultsAzureSqlManagedInstance.monthlyCostOptions = monthlyCostOptions; + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstance.targetSku + = SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlManagedInstance; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.java new file mode 100644 index 000000000000..a5137959139c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlManagedInstanceTargetSku model. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlManagedInstanceTargetSku + implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory category; + + /* + * Compute Size in vCores. + */ + private Integer computeSize; + + /* + * maximum storage for this particular SKU, in MB. + */ + private Double storageMaxSizeInMb; + + /* + * The predicted data size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedDataSizeInMb; + + /* + * The predicted log size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedLogSizeInMb; + + /* + * The maximum storage IOPS in Azure SQL, will impact the billing cost. + */ + private Double maxStorageIops; + + /* + * The maximum throughput in Azure SQL, will impact the billing cost. + */ + private Double maxThroughputMBps; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSku class. + */ + private SkuRecommendationResultsAzureSqlManagedInstanceTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory category() { + return this.category; + } + + /** + * Get the computeSize property: Compute Size in vCores. + * + * @return the computeSize value. + */ + public Integer computeSize() { + return this.computeSize; + } + + /** + * Get the storageMaxSizeInMb property: maximum storage for this particular SKU, in MB. + * + * @return the storageMaxSizeInMb value. + */ + public Double storageMaxSizeInMb() { + return this.storageMaxSizeInMb; + } + + /** + * Get the predictedDataSizeInMb property: The predicted data size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedDataSizeInMb value. + */ + public Double predictedDataSizeInMb() { + return this.predictedDataSizeInMb; + } + + /** + * Get the predictedLogSizeInMb property: The predicted log size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedLogSizeInMb value. + */ + public Double predictedLogSizeInMb() { + return this.predictedLogSizeInMb; + } + + /** + * Get the maxStorageIops property: The maximum storage IOPS in Azure SQL, will impact the billing cost. + * + * @return the maxStorageIops value. + */ + public Double maxStorageIops() { + return this.maxStorageIops; + } + + /** + * Get the maxThroughputMBps property: The maximum throughput in Azure SQL, will impact the billing cost. + * + * @return the maxThroughputMBps value. + */ + public Double maxThroughputMBps() { + return this.maxThroughputMBps; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + jsonWriter.writeNumberField("computeSize", this.computeSize); + jsonWriter.writeNumberField("storageMaxSizeInMb", this.storageMaxSizeInMb); + jsonWriter.writeNumberField("predictedDataSizeInMb", this.predictedDataSizeInMb); + jsonWriter.writeNumberField("predictedLogSizeInMb", this.predictedLogSizeInMb); + jsonWriter.writeNumberField("maxStorageIops", this.maxStorageIops); + jsonWriter.writeNumberField("maxThroughputMBps", this.maxThroughputMBps); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSku if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlManagedInstanceTargetSku. + */ + public static SkuRecommendationResultsAzureSqlManagedInstanceTargetSku fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlManagedInstanceTargetSku deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku + = new SkuRecommendationResultsAzureSqlManagedInstanceTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.category + = SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.fromJson(reader); + } else if ("computeSize".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.computeSize + = reader.getNullable(JsonReader::getInt); + } else if ("storageMaxSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.storageMaxSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedDataSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.predictedDataSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedLogSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.predictedLogSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("maxStorageIops".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.maxStorageIops + = reader.getNullable(JsonReader::getDouble); + } else if ("maxThroughputMBps".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku.maxThroughputMBps + = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.java new file mode 100644 index 000000000000..212851ceda4e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory model. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory + implements JsonSerializable { + /* + * The compute tier of the target SKU. + */ + private String computeTier; + + /* + * The hardware type of the target SKU. + */ + private String hardwareType; + + /* + * The SQL purchasing model of the target SKU. + */ + private String sqlPurchasingModel; + + /* + * The SQL service tier of the target SKU. + */ + private String sqlServiceTier; + + /* + * Indicates if zone redundancy is available for the target SKU. + */ + private Boolean zoneRedundancyAvailable; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory class. + */ + private SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory() { + } + + /** + * Get the computeTier property: The compute tier of the target SKU. + * + * @return the computeTier value. + */ + public String computeTier() { + return this.computeTier; + } + + /** + * Get the hardwareType property: The hardware type of the target SKU. + * + * @return the hardwareType value. + */ + public String hardwareType() { + return this.hardwareType; + } + + /** + * Get the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @return the sqlPurchasingModel value. + */ + public String sqlPurchasingModel() { + return this.sqlPurchasingModel; + } + + /** + * Get the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @return the sqlServiceTier value. + */ + public String sqlServiceTier() { + return this.sqlServiceTier; + } + + /** + * Get the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @return the zoneRedundancyAvailable value. + */ + public Boolean zoneRedundancyAvailable() { + return this.zoneRedundancyAvailable; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computeTier", this.computeTier); + jsonWriter.writeStringField("hardwareType", this.hardwareType); + jsonWriter.writeStringField("sqlPurchasingModel", this.sqlPurchasingModel); + jsonWriter.writeStringField("sqlServiceTier", this.sqlServiceTier); + jsonWriter.writeBooleanField("zoneRedundancyAvailable", this.zoneRedundancyAvailable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory. + */ + public static SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory + = new SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.computeTier + = reader.getString(); + } else if ("hardwareType".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.hardwareType + = reader.getString(); + } else if ("sqlPurchasingModel".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.sqlPurchasingModel + = reader.getString(); + } else if ("sqlServiceTier".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.sqlServiceTier + = reader.getString(); + } else if ("zoneRedundancyAvailable".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.zoneRedundancyAvailable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java new file mode 100644 index 000000000000..79c3f053b383 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * SKU Recommendation results for Azure SQL Virtual Machine. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlVirtualMachine + implements JsonSerializable { + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * Number of blocker issues to fix before migrating to the target platform. + */ + private Integer numberOfServerBlockerIssues; + + /* + * The monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The monthly cost for all different savings options applicable for the particular SKU. + */ + private List monthlyCostOptions; + + /* + * The targetSku property. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachine class. + */ + private SkuRecommendationResultsAzureSqlVirtualMachine() { + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Get the numberOfServerBlockerIssues property: Number of blocker issues to fix before migrating to the target + * platform. + * + * @return the numberOfServerBlockerIssues value. + */ + public Integer numberOfServerBlockerIssues() { + return this.numberOfServerBlockerIssues; + } + + /** + * Get the monthlyCost property: The monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Get the monthlyCostOptions property: The monthly cost for all different savings options applicable for the + * particular SKU. + * + * @return the monthlyCostOptions value. + */ + public List monthlyCostOptions() { + return this.monthlyCostOptions; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSku targetSku() { + return this.targetSku; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeNumberField("numberOfServerBlockerIssues", this.numberOfServerBlockerIssues); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachine from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachine if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlVirtualMachine. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachine fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachine deserializedSkuRecommendationResultsAzureSqlVirtualMachine + = new SkuRecommendationResultsAzureSqlVirtualMachine(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("numberOfServerBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.numberOfServerBlockerIssues + = reader.getNullable(JsonReader::getInt); + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("monthlyCostOptions".equals(fieldName)) { + List monthlyCostOptions + = reader.readArray(reader1 -> SkuRecommendationResultsMonthlyCostOptionItem.fromJson(reader1)); + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.monthlyCostOptions = monthlyCostOptions; + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachine.targetSku + = SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachine; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.java new file mode 100644 index 000000000000..59373df6f4a7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SkuRecommendationResultsAzureSqlVirtualMachineTargetSku model. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSku + implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory category; + + /* + * Compute Size in vCores. + */ + private Integer computeSize; + + /* + * The predicted data size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedDataSizeInMb; + + /* + * The predicted log size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedLogSizeInMb; + + /* + * size parameters for VM size. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize virtualMachineSize; + + /* + * Data disk sizes. + */ + private List dataDiskSizes; + + /* + * Log disk sizes. + */ + private List logDiskSizes; + + /* + * temp db disk sizes. + */ + private List tempDbDiskSizes; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSku class. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory category() { + return this.category; + } + + /** + * Get the computeSize property: Compute Size in vCores. + * + * @return the computeSize value. + */ + public Integer computeSize() { + return this.computeSize; + } + + /** + * Get the predictedDataSizeInMb property: The predicted data size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedDataSizeInMb value. + */ + public Double predictedDataSizeInMb() { + return this.predictedDataSizeInMb; + } + + /** + * Get the predictedLogSizeInMb property: The predicted log size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedLogSizeInMb value. + */ + public Double predictedLogSizeInMb() { + return this.predictedLogSizeInMb; + } + + /** + * Get the virtualMachineSize property: size parameters for VM size. + * + * @return the virtualMachineSize value. + */ + public SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize virtualMachineSize() { + return this.virtualMachineSize; + } + + /** + * Get the dataDiskSizes property: Data disk sizes. + * + * @return the dataDiskSizes value. + */ + public List dataDiskSizes() { + return this.dataDiskSizes; + } + + /** + * Get the logDiskSizes property: Log disk sizes. + * + * @return the logDiskSizes value. + */ + public List logDiskSizes() { + return this.logDiskSizes; + } + + /** + * Get the tempDbDiskSizes property: temp db disk sizes. + * + * @return the tempDbDiskSizes value. + */ + public List tempDbDiskSizes() { + return this.tempDbDiskSizes; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + jsonWriter.writeNumberField("computeSize", this.computeSize); + jsonWriter.writeNumberField("predictedDataSizeInMb", this.predictedDataSizeInMb); + jsonWriter.writeNumberField("predictedLogSizeInMb", this.predictedLogSizeInMb); + jsonWriter.writeJsonField("virtualMachineSize", this.virtualMachineSize); + jsonWriter.writeArrayField("dataDiskSizes", this.dataDiskSizes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("logDiskSizes", this.logDiskSizes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("tempDbDiskSizes", this.tempDbDiskSizes, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSku if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsAzureSqlVirtualMachineTargetSku. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachineTargetSku fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSku deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku + = new SkuRecommendationResultsAzureSqlVirtualMachineTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.category + = SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.fromJson(reader); + } else if ("computeSize".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.computeSize + = reader.getNullable(JsonReader::getInt); + } else if ("predictedDataSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.predictedDataSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedLogSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.predictedLogSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("virtualMachineSize".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.virtualMachineSize + = SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.fromJson(reader); + } else if ("dataDiskSizes".equals(fieldName)) { + List dataDiskSizes = reader.readArray(reader1 -> DiskSizes.fromJson(reader1)); + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.dataDiskSizes = dataDiskSizes; + } else if ("logDiskSizes".equals(fieldName)) { + List logDiskSizes = reader.readArray(reader1 -> DiskSizes.fromJson(reader1)); + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.logDiskSizes = logDiskSizes; + } else if ("tempDbDiskSizes".equals(fieldName)) { + List tempDbDiskSizes = reader.readArray(reader1 -> DiskSizes.fromJson(reader1)); + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku.tempDbDiskSizes + = tempDbDiskSizes; + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java new file mode 100644 index 000000000000..41a0bbf00ba7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory model. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory + implements JsonSerializable { + /* + * Available VM SKUs for the Azure SQL Virtual Machine. + */ + private List availableVmSkus; + + /* + * The virtual machine family of the target SKU. + */ + private String virtualMachineFamily; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory class. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory() { + } + + /** + * Get the availableVmSkus property: Available VM SKUs for the Azure SQL Virtual Machine. + * + * @return the availableVmSkus value. + */ + public List availableVmSkus() { + return this.availableVmSkus; + } + + /** + * Get the virtualMachineFamily property: The virtual machine family of the target SKU. + * + * @return the virtualMachineFamily value. + */ + public String virtualMachineFamily() { + return this.virtualMachineFamily; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("availableVmSkus", this.availableVmSkus, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("virtualMachineFamily", this.virtualMachineFamily); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory + = new SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availableVmSkus".equals(fieldName)) { + List availableVmSkus = reader.readArray(reader1 -> reader1.getString()); + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.availableVmSkus + = availableVmSkus; + } else if ("virtualMachineFamily".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.virtualMachineFamily + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.java new file mode 100644 index 000000000000..6b601fbf802d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * size parameters for VM size. + */ +@Immutable +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize + implements JsonSerializable { + /* + * Virtual Machine Family, for example : standardMSFamily + */ + private String virtualMachineFamily; + + /* + * VM Size, for example : M64ls + */ + private String sizeName; + + /* + * Compute Size in vCores. + */ + private Integer computeSize; + + /* + * Virtual Machine SKU name,: Eg : Standard_F16s. + */ + private String azureSkuName; + + /* + * Available vCores. This can be less than the vCores in the Constrained vCPU VM Sizes. + */ + private Integer vCPUsAvailable; + + /* + * maximum network interfaces. + */ + private Integer maxNetworkInterfaces; + + /** + * Creates an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize class. + */ + private SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize() { + } + + /** + * Get the virtualMachineFamily property: Virtual Machine Family, for example : standardMSFamily. + * + * @return the virtualMachineFamily value. + */ + public String virtualMachineFamily() { + return this.virtualMachineFamily; + } + + /** + * Get the sizeName property: VM Size, for example : M64ls. + * + * @return the sizeName value. + */ + public String sizeName() { + return this.sizeName; + } + + /** + * Get the computeSize property: Compute Size in vCores. + * + * @return the computeSize value. + */ + public Integer computeSize() { + return this.computeSize; + } + + /** + * Get the azureSkuName property: Virtual Machine SKU name,: Eg : Standard_F16s. + * + * @return the azureSkuName value. + */ + public String azureSkuName() { + return this.azureSkuName; + } + + /** + * Get the vCPUsAvailable property: Available vCores. This can be less than the vCores in the Constrained vCPU VM + * Sizes. + * + * @return the vCPUsAvailable value. + */ + public Integer vCPUsAvailable() { + return this.vCPUsAvailable; + } + + /** + * Get the maxNetworkInterfaces property: maximum network interfaces. + * + * @return the maxNetworkInterfaces value. + */ + public Integer maxNetworkInterfaces() { + return this.maxNetworkInterfaces; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("virtualMachineFamily", this.virtualMachineFamily); + jsonWriter.writeStringField("sizeName", this.sizeName); + jsonWriter.writeNumberField("computeSize", this.computeSize); + jsonWriter.writeStringField("azureSkuName", this.azureSkuName); + jsonWriter.writeNumberField("vCPUsAvailable", this.vCPUsAvailable); + jsonWriter.writeNumberField("maxNetworkInterfaces", this.maxNetworkInterfaces); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize from the + * JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize if the + * JsonReader was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize. + */ + public static SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize + fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize + = new SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("virtualMachineFamily".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.virtualMachineFamily + = reader.getString(); + } else if ("sizeName".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.sizeName + = reader.getString(); + } else if ("computeSize".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.computeSize + = reader.getNullable(JsonReader::getInt); + } else if ("azureSkuName".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.azureSkuName + = reader.getString(); + } else if ("vCPUsAvailable".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.vCPUsAvailable + = reader.getNullable(JsonReader::getInt); + } else if ("maxNetworkInterfaces".equals(fieldName)) { + deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.maxNetworkInterfaces + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.java new file mode 100644 index 000000000000..449c13a171c5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The monthly cost of the particular SKU. + */ +@Immutable +public final class SkuRecommendationResultsMonthlyCost + implements JsonSerializable { + /* + * Represents the Cost of Compute. + */ + private Double computeCost; + + /* + * Represents the Cost of Storage. + */ + private Double storageCost; + + /* + * Represents the Cost of IOPS. + */ + private Double iopsCost; + + /* + * Represents the Cost of SQL license. + */ + private Double sqlLicenseCost; + + /* + * Represents the Cost of Windows license. + */ + private Double windowsLicenseCost; + + /* + * Represents the Total Cost. + */ + private Double totalCost; + + /** + * Creates an instance of SkuRecommendationResultsMonthlyCost class. + */ + private SkuRecommendationResultsMonthlyCost() { + } + + /** + * Get the computeCost property: Represents the Cost of Compute. + * + * @return the computeCost value. + */ + public Double computeCost() { + return this.computeCost; + } + + /** + * Get the storageCost property: Represents the Cost of Storage. + * + * @return the storageCost value. + */ + public Double storageCost() { + return this.storageCost; + } + + /** + * Get the iopsCost property: Represents the Cost of IOPS. + * + * @return the iopsCost value. + */ + public Double iopsCost() { + return this.iopsCost; + } + + /** + * Get the sqlLicenseCost property: Represents the Cost of SQL license. + * + * @return the sqlLicenseCost value. + */ + public Double sqlLicenseCost() { + return this.sqlLicenseCost; + } + + /** + * Get the windowsLicenseCost property: Represents the Cost of Windows license. + * + * @return the windowsLicenseCost value. + */ + public Double windowsLicenseCost() { + return this.windowsLicenseCost; + } + + /** + * Get the totalCost property: Represents the Total Cost. + * + * @return the totalCost value. + */ + public Double totalCost() { + return this.totalCost; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("computeCost", this.computeCost); + jsonWriter.writeNumberField("storageCost", this.storageCost); + jsonWriter.writeNumberField("iopsCost", this.iopsCost); + jsonWriter.writeNumberField("sqlLicenseCost", this.sqlLicenseCost); + jsonWriter.writeNumberField("windowsLicenseCost", this.windowsLicenseCost); + jsonWriter.writeNumberField("totalCost", this.totalCost); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsMonthlyCost from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsMonthlyCost if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsMonthlyCost. + */ + public static SkuRecommendationResultsMonthlyCost fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsMonthlyCost deserializedSkuRecommendationResultsMonthlyCost + = new SkuRecommendationResultsMonthlyCost(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.computeCost + = reader.getNullable(JsonReader::getDouble); + } else if ("storageCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.storageCost + = reader.getNullable(JsonReader::getDouble); + } else if ("iopsCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.iopsCost + = reader.getNullable(JsonReader::getDouble); + } else if ("sqlLicenseCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.sqlLicenseCost + = reader.getNullable(JsonReader::getDouble); + } else if ("windowsLicenseCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.windowsLicenseCost + = reader.getNullable(JsonReader::getDouble); + } else if ("totalCost".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCost.totalCost + = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsMonthlyCost; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCostOptionItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCostOptionItem.java new file mode 100644 index 000000000000..ce56b6e97820 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCostOptionItem.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The monthly cost values for this saving option combination for the particular SKU. + */ +@Immutable +public final class SkuRecommendationResultsMonthlyCostOptionItem + implements JsonSerializable { + /* + * The unique combination of saving options for a price e.g. With1YearASPAndProd. + */ + private String keyName; + + /* + * The Monthly cost of the particular SKU. + */ + private CostTypeValues keyValue; + + /** + * Creates an instance of SkuRecommendationResultsMonthlyCostOptionItem class. + */ + private SkuRecommendationResultsMonthlyCostOptionItem() { + } + + /** + * Get the keyName property: The unique combination of saving options for a price e.g. With1YearASPAndProd. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Get the keyValue property: The Monthly cost of the particular SKU. + * + * @return the keyValue value. + */ + public CostTypeValues keyValue() { + return this.keyValue; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyName", this.keyName); + jsonWriter.writeJsonField("keyValue", this.keyValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationResultsMonthlyCostOptionItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationResultsMonthlyCostOptionItem if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationResultsMonthlyCostOptionItem. + */ + public static SkuRecommendationResultsMonthlyCostOptionItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationResultsMonthlyCostOptionItem deserializedSkuRecommendationResultsMonthlyCostOptionItem + = new SkuRecommendationResultsMonthlyCostOptionItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyName".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCostOptionItem.keyName = reader.getString(); + } else if ("keyValue".equals(fieldName)) { + deserializedSkuRecommendationResultsMonthlyCostOptionItem.keyValue + = CostTypeValues.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationResultsMonthlyCostOptionItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java new file mode 100644 index 000000000000..237b15775859 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SKU recommendation summary. + */ +@Immutable +public final class SkuRecommendationSummary implements JsonSerializable { + /* + * Number of blocker issues to fix before migrating this database to the target platform. + */ + private Integer numOfBlockerIssues; + + /* + * The target recommendation Status for this database. + */ + private RecommendationStatus recommendationStatus; + + /* + * The impactedObjectsSummary property. + */ + private List impactedObjectsSummary; + + /* + * The monthly cost of the particular SKU. + */ + private SkuRecommendationResultsMonthlyCost monthlyCost; + + /* + * The monthly cost for all different savings options applicable for the particular SKU. + */ + private List monthlyCostOptions; + + /* + * The targetSku property. + */ + private SkuRecommendationSummaryTargetSku targetSku; + + /** + * Creates an instance of SkuRecommendationSummary class. + */ + private SkuRecommendationSummary() { + } + + /** + * Get the numOfBlockerIssues property: Number of blocker issues to fix before migrating this database to the target + * platform. + * + * @return the numOfBlockerIssues value. + */ + public Integer numOfBlockerIssues() { + return this.numOfBlockerIssues; + } + + /** + * Get the recommendationStatus property: The target recommendation Status for this database. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Get the impactedObjectsSummary property: The impactedObjectsSummary property. + * + * @return the impactedObjectsSummary value. + */ + public List impactedObjectsSummary() { + return this.impactedObjectsSummary; + } + + /** + * Get the monthlyCost property: The monthly cost of the particular SKU. + * + * @return the monthlyCost value. + */ + public SkuRecommendationResultsMonthlyCost monthlyCost() { + return this.monthlyCost; + } + + /** + * Get the monthlyCostOptions property: The monthly cost for all different savings options applicable for the + * particular SKU. + * + * @return the monthlyCostOptions value. + */ + public List monthlyCostOptions() { + return this.monthlyCostOptions; + } + + /** + * Get the targetSku property: The targetSku property. + * + * @return the targetSku value. + */ + public SkuRecommendationSummaryTargetSku targetSku() { + return this.targetSku; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("numOfBlockerIssues", this.numOfBlockerIssues); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeJsonField("monthlyCost", this.monthlyCost); + jsonWriter.writeJsonField("targetSku", this.targetSku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationSummary if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationSummary. + */ + public static SkuRecommendationSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationSummary deserializedSkuRecommendationSummary = new SkuRecommendationSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("numOfBlockerIssues".equals(fieldName)) { + deserializedSkuRecommendationSummary.numOfBlockerIssues = reader.getNullable(JsonReader::getInt); + } else if ("recommendationStatus".equals(fieldName)) { + deserializedSkuRecommendationSummary.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("impactedObjectsSummary".equals(fieldName)) { + List impactedObjectsSummary + = reader.readArray(reader1 -> ImpactedObjectsInfo.fromJson(reader1)); + deserializedSkuRecommendationSummary.impactedObjectsSummary = impactedObjectsSummary; + } else if ("monthlyCost".equals(fieldName)) { + deserializedSkuRecommendationSummary.monthlyCost + = SkuRecommendationResultsMonthlyCost.fromJson(reader); + } else if ("monthlyCostOptions".equals(fieldName)) { + List monthlyCostOptions + = reader.readArray(reader1 -> SkuRecommendationResultsMonthlyCostOptionItem.fromJson(reader1)); + deserializedSkuRecommendationSummary.monthlyCostOptions = monthlyCostOptions; + } else if ("targetSku".equals(fieldName)) { + deserializedSkuRecommendationSummary.targetSku = SkuRecommendationSummaryTargetSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationSummary; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSku.java new file mode 100644 index 000000000000..ea800f156e1c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSku.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationSummaryTargetSku model. + */ +@Immutable +public final class SkuRecommendationSummaryTargetSku implements JsonSerializable { + /* + * The category property. + */ + private SkuRecommendationSummaryTargetSkuCategory category; + + /* + * Compute Size in vCores. + */ + private Integer computeSize; + + /* + * max storage for this particular SKU, in MB. + */ + private Double storageMaxSizeInMb; + + /* + * The predicted data size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedDataSizeInMb; + + /* + * The predicted log size in MB in Azure SQL, will impact the billing cost. + */ + private Double predictedLogSizeInMb; + + /* + * The max storage IOPS in Azure SQL, will impact the billing cost. + */ + private Double maxStorageIops; + + /* + * The max throughput in Azure SQL, will impact the billing cost. + */ + private Double maxThroughputMBps; + + /** + * Creates an instance of SkuRecommendationSummaryTargetSku class. + */ + private SkuRecommendationSummaryTargetSku() { + } + + /** + * Get the category property: The category property. + * + * @return the category value. + */ + public SkuRecommendationSummaryTargetSkuCategory category() { + return this.category; + } + + /** + * Get the computeSize property: Compute Size in vCores. + * + * @return the computeSize value. + */ + public Integer computeSize() { + return this.computeSize; + } + + /** + * Get the storageMaxSizeInMb property: max storage for this particular SKU, in MB. + * + * @return the storageMaxSizeInMb value. + */ + public Double storageMaxSizeInMb() { + return this.storageMaxSizeInMb; + } + + /** + * Get the predictedDataSizeInMb property: The predicted data size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedDataSizeInMb value. + */ + public Double predictedDataSizeInMb() { + return this.predictedDataSizeInMb; + } + + /** + * Get the predictedLogSizeInMb property: The predicted log size in MB in Azure SQL, will impact the billing cost. + * + * @return the predictedLogSizeInMb value. + */ + public Double predictedLogSizeInMb() { + return this.predictedLogSizeInMb; + } + + /** + * Get the maxStorageIops property: The max storage IOPS in Azure SQL, will impact the billing cost. + * + * @return the maxStorageIops value. + */ + public Double maxStorageIops() { + return this.maxStorageIops; + } + + /** + * Get the maxThroughputMBps property: The max throughput in Azure SQL, will impact the billing cost. + * + * @return the maxThroughputMBps value. + */ + public Double maxThroughputMBps() { + return this.maxThroughputMBps; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("category", this.category); + jsonWriter.writeNumberField("computeSize", this.computeSize); + jsonWriter.writeNumberField("storageMaxSizeInMb", this.storageMaxSizeInMb); + jsonWriter.writeNumberField("predictedDataSizeInMb", this.predictedDataSizeInMb); + jsonWriter.writeNumberField("predictedLogSizeInMb", this.predictedLogSizeInMb); + jsonWriter.writeNumberField("maxStorageIops", this.maxStorageIops); + jsonWriter.writeNumberField("maxThroughputMBps", this.maxThroughputMBps); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationSummaryTargetSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationSummaryTargetSku if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationSummaryTargetSku. + */ + public static SkuRecommendationSummaryTargetSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationSummaryTargetSku deserializedSkuRecommendationSummaryTargetSku + = new SkuRecommendationSummaryTargetSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.category + = SkuRecommendationSummaryTargetSkuCategory.fromJson(reader); + } else if ("computeSize".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.computeSize = reader.getNullable(JsonReader::getInt); + } else if ("storageMaxSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.storageMaxSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedDataSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.predictedDataSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("predictedLogSizeInMb".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.predictedLogSizeInMb + = reader.getNullable(JsonReader::getDouble); + } else if ("maxStorageIops".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.maxStorageIops + = reader.getNullable(JsonReader::getDouble); + } else if ("maxThroughputMBps".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSku.maxThroughputMBps + = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationSummaryTargetSku; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSkuCategory.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSkuCategory.java new file mode 100644 index 000000000000..e2fe3abdfd5d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSkuCategory.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SkuRecommendationSummaryTargetSkuCategory model. + */ +@Immutable +public final class SkuRecommendationSummaryTargetSkuCategory + implements JsonSerializable { + /* + * The compute tier of the target SKU. + */ + private String computeTier; + + /* + * The hardware type of the target SKU. + */ + private String hardwareType; + + /* + * The SQL purchasing model of the target SKU. + */ + private String sqlPurchasingModel; + + /* + * The SQL service tier of the target SKU. + */ + private String sqlServiceTier; + + /* + * Indicates if zone redundancy is available for the target SKU. + */ + private Boolean zoneRedundancyAvailable; + + /** + * Creates an instance of SkuRecommendationSummaryTargetSkuCategory class. + */ + private SkuRecommendationSummaryTargetSkuCategory() { + } + + /** + * Get the computeTier property: The compute tier of the target SKU. + * + * @return the computeTier value. + */ + public String computeTier() { + return this.computeTier; + } + + /** + * Get the hardwareType property: The hardware type of the target SKU. + * + * @return the hardwareType value. + */ + public String hardwareType() { + return this.hardwareType; + } + + /** + * Get the sqlPurchasingModel property: The SQL purchasing model of the target SKU. + * + * @return the sqlPurchasingModel value. + */ + public String sqlPurchasingModel() { + return this.sqlPurchasingModel; + } + + /** + * Get the sqlServiceTier property: The SQL service tier of the target SKU. + * + * @return the sqlServiceTier value. + */ + public String sqlServiceTier() { + return this.sqlServiceTier; + } + + /** + * Get the zoneRedundancyAvailable property: Indicates if zone redundancy is available for the target SKU. + * + * @return the zoneRedundancyAvailable value. + */ + public Boolean zoneRedundancyAvailable() { + return this.zoneRedundancyAvailable; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computeTier", this.computeTier); + jsonWriter.writeStringField("hardwareType", this.hardwareType); + jsonWriter.writeStringField("sqlPurchasingModel", this.sqlPurchasingModel); + jsonWriter.writeStringField("sqlServiceTier", this.sqlServiceTier); + jsonWriter.writeBooleanField("zoneRedundancyAvailable", this.zoneRedundancyAvailable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuRecommendationSummaryTargetSkuCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuRecommendationSummaryTargetSkuCategory if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SkuRecommendationSummaryTargetSkuCategory. + */ + public static SkuRecommendationSummaryTargetSkuCategory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuRecommendationSummaryTargetSkuCategory deserializedSkuRecommendationSummaryTargetSkuCategory + = new SkuRecommendationSummaryTargetSkuCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computeTier".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSkuCategory.computeTier = reader.getString(); + } else if ("hardwareType".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSkuCategory.hardwareType = reader.getString(); + } else if ("sqlPurchasingModel".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSkuCategory.sqlPurchasingModel = reader.getString(); + } else if ("sqlServiceTier".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSkuCategory.sqlServiceTier = reader.getString(); + } else if ("zoneRedundancyAvailable".equals(fieldName)) { + deserializedSkuRecommendationSummaryTargetSkuCategory.zoneRedundancyAvailable + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuRecommendationSummaryTargetSkuCategory; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java new file mode 100644 index 000000000000..d0c6f7f037aa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Arc Sql availability group database replica resource. + */ +@Fluent +public final class SqlAvailabilityGroupDatabaseReplicaResourceProperties + implements JsonSerializable { + /* + * the database name. + */ + private String databaseName; + + /* + * the database replica name. + */ + private String replicaName; + + /* + * Whether the availability database is local. + */ + private Boolean isLocal; + + /* + * Returns 1 if the replica is primary, or 0 if it is a secondary replica. + */ + private Boolean isPrimaryReplica; + + /* + * Description of the data-movement state. + */ + private String synchronizationStateDescription; + + /* + * Whether this replica is transaction committer. + */ + private Boolean isCommitParticipant; + + /* + * Description of the health of database. + */ + private String synchronizationHealthDescription; + + /* + * Description of the database state of the availability replica. + */ + private String databaseStateDescription; + + /* + * Whether this data movement is suspended. + */ + private Boolean isSuspended; + + /* + * Description of the database suspended state reason. + */ + private String suspendReasonDescription; + + /** + * Creates an instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties class. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties() { + } + + /** + * Get the databaseName property: the database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: the database name. + * + * @param databaseName the databaseName value to set. + * @return the SqlAvailabilityGroupDatabaseReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupDatabaseReplicaResourceProperties withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the replicaName property: the database replica name. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Get the isLocal property: Whether the availability database is local. + * + * @return the isLocal value. + */ + public Boolean isLocal() { + return this.isLocal; + } + + /** + * Get the isPrimaryReplica property: Returns 1 if the replica is primary, or 0 if it is a secondary replica. + * + * @return the isPrimaryReplica value. + */ + public Boolean isPrimaryReplica() { + return this.isPrimaryReplica; + } + + /** + * Get the synchronizationStateDescription property: Description of the data-movement state. + * + * @return the synchronizationStateDescription value. + */ + public String synchronizationStateDescription() { + return this.synchronizationStateDescription; + } + + /** + * Get the isCommitParticipant property: Whether this replica is transaction committer. + * + * @return the isCommitParticipant value. + */ + public Boolean isCommitParticipant() { + return this.isCommitParticipant; + } + + /** + * Get the synchronizationHealthDescription property: Description of the health of database. + * + * @return the synchronizationHealthDescription value. + */ + public String synchronizationHealthDescription() { + return this.synchronizationHealthDescription; + } + + /** + * Get the databaseStateDescription property: Description of the database state of the availability replica. + * + * @return the databaseStateDescription value. + */ + public String databaseStateDescription() { + return this.databaseStateDescription; + } + + /** + * Get the isSuspended property: Whether this data movement is suspended. + * + * @return the isSuspended value. + */ + public Boolean isSuspended() { + return this.isSuspended; + } + + /** + * Get the suspendReasonDescription property: Description of the database suspended state reason. + * + * @return the suspendReasonDescription value. + */ + public String suspendReasonDescription() { + return this.suspendReasonDescription; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("databaseName", this.databaseName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupDatabaseReplicaResourceProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupDatabaseReplicaResourceProperties. + */ + public static SqlAvailabilityGroupDatabaseReplicaResourceProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupDatabaseReplicaResourceProperties deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties + = new SqlAvailabilityGroupDatabaseReplicaResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("databaseName".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.databaseName = reader.getString(); + } else if ("replicaName".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.replicaName = reader.getString(); + } else if ("isLocal".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isLocal + = reader.getNullable(JsonReader::getBoolean); + } else if ("isPrimaryReplica".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isPrimaryReplica + = reader.getNullable(JsonReader::getBoolean); + } else if ("synchronizationStateDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.synchronizationStateDescription + = reader.getString(); + } else if ("isCommitParticipant".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isCommitParticipant + = reader.getNullable(JsonReader::getBoolean); + } else if ("synchronizationHealthDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.synchronizationHealthDescription + = reader.getString(); + } else if ("databaseStateDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.databaseStateDescription + = reader.getString(); + } else if ("isSuspended".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.isSuspended + = reader.getNullable(JsonReader::getBoolean); + } else if ("suspendReasonDescription".equals(fieldName)) { + deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties.suspendReasonDescription + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupDatabaseReplicaResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java new file mode 100644 index 000000000000..de310bc24a85 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem model. + */ +@Fluent +public final class SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem + implements JsonSerializable { + /* + * IPV4 address + */ + private String ipAddress; + + /* + * IPV4 netmask + */ + private String mask; + + /** + * Creates an instance of SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem class. + */ + public SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() { + } + + /** + * Get the ipAddress property: IPV4 address. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: IPV4 address. + * + * @param ipAddress the ipAddress value to set. + * @return the SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem object itself. + */ + public SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get the mask property: IPV4 netmask. + * + * @return the mask value. + */ + public String mask() { + return this.mask; + } + + /** + * Set the mask property: IPV4 netmask. + * + * @param mask the mask value to set. + * @return the SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem object itself. + */ + public SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem withMask(String mask) { + this.mask = mask; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("ipAddress", this.ipAddress); + jsonWriter.writeStringField("mask", this.mask); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem. + */ + public static SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem + = new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipAddress".equals(fieldName)) { + deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.ipAddress = reader.getString(); + } else if ("mask".equals(fieldName)) { + deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.mask = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java new file mode 100644 index 000000000000..26427f8720e3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Arc Sql availability group replica resource. + */ +@Fluent +public final class SqlAvailabilityGroupReplicaResourceProperties + implements JsonSerializable { + /* + * ID GUID of the availability group. + */ + private String replicaId; + + /* + * The replica name. + */ + private String replicaName; + + /* + * Resource id of this replica. This is required for a distributed availability group, in which case it describes + * the location of the availability group that hosts one replica in the DAG. In a non-distributed availability group + * this field is optional but can be used to store the Azure resource id for AG. + */ + private String replicaResourceId; + + /* + * null + */ + private AvailabilityGroupConfigure configure; + + /* + * null + */ + private AvailabilityGroupState state; + + /** + * Creates an instance of SqlAvailabilityGroupReplicaResourceProperties class. + */ + public SqlAvailabilityGroupReplicaResourceProperties() { + } + + /** + * Get the replicaId property: ID GUID of the availability group. + * + * @return the replicaId value. + */ + public String replicaId() { + return this.replicaId; + } + + /** + * Get the replicaName property: The replica name. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Set the replicaName property: The replica name. + * + * @param replicaName the replicaName value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withReplicaName(String replicaName) { + this.replicaName = replicaName; + return this; + } + + /** + * Get the replicaResourceId property: Resource id of this replica. This is required for a distributed availability + * group, in which case it describes the location of the availability group that hosts one replica in the DAG. In a + * non-distributed availability group this field is optional but can be used to store the Azure resource id for AG. + * + * @return the replicaResourceId value. + */ + public String replicaResourceId() { + return this.replicaResourceId; + } + + /** + * Set the replicaResourceId property: Resource id of this replica. This is required for a distributed availability + * group, in which case it describes the location of the availability group that hosts one replica in the DAG. In a + * non-distributed availability group this field is optional but can be used to store the Azure resource id for AG. + * + * @param replicaResourceId the replicaResourceId value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withReplicaResourceId(String replicaResourceId) { + this.replicaResourceId = replicaResourceId; + return this; + } + + /** + * Get the configure property: null. + * + * @return the configure value. + */ + public AvailabilityGroupConfigure configure() { + return this.configure; + } + + /** + * Set the configure property: null. + * + * @param configure the configure value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withConfigure(AvailabilityGroupConfigure configure) { + this.configure = configure; + return this; + } + + /** + * Get the state property: null. + * + * @return the state value. + */ + public AvailabilityGroupState state() { + return this.state; + } + + /** + * Set the state property: null. + * + * @param state the state value to set. + * @return the SqlAvailabilityGroupReplicaResourceProperties object itself. + */ + public SqlAvailabilityGroupReplicaResourceProperties withState(AvailabilityGroupState state) { + this.state = state; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("replicaName", this.replicaName); + jsonWriter.writeStringField("replicaResourceId", this.replicaResourceId); + jsonWriter.writeJsonField("configure", this.configure); + jsonWriter.writeJsonField("state", this.state); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupReplicaResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupReplicaResourceProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupReplicaResourceProperties. + */ + public static SqlAvailabilityGroupReplicaResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupReplicaResourceProperties deserializedSqlAvailabilityGroupReplicaResourceProperties + = new SqlAvailabilityGroupReplicaResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("replicaId".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.replicaId = reader.getString(); + } else if ("replicaName".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.replicaName = reader.getString(); + } else if ("replicaResourceId".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.replicaResourceId = reader.getString(); + } else if ("configure".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.configure + = AvailabilityGroupConfigure.fromJson(reader); + } else if ("state".equals(fieldName)) { + deserializedSqlAvailabilityGroupReplicaResourceProperties.state + = AvailabilityGroupState.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupReplicaResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIPListenerProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIPListenerProperties.java new file mode 100644 index 000000000000..fbfe9b3567de --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIPListenerProperties.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a static IP Arc Sql availability group listener. + */ +@Fluent +public final class SqlAvailabilityGroupStaticIPListenerProperties + implements JsonSerializable { + /* + * the DNS name for the listener. + */ + private String dnsName; + + /* + * IP V4 Addresses and masks for the listener. + */ + private List ipV4AddressesAndMasks; + + /* + * IP V6 Addresses for the listener + */ + private List ipV6Addresses; + + /* + * Network port for the listener. Default is 1433. + */ + private Integer port; + + /** + * Creates an instance of SqlAvailabilityGroupStaticIPListenerProperties class. + */ + public SqlAvailabilityGroupStaticIPListenerProperties() { + } + + /** + * Get the dnsName property: the DNS name for the listener. + * + * @return the dnsName value. + */ + public String dnsName() { + return this.dnsName; + } + + /** + * Set the dnsName property: the DNS name for the listener. + * + * @param dnsName the dnsName value to set. + * @return the SqlAvailabilityGroupStaticIPListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIPListenerProperties withDnsName(String dnsName) { + this.dnsName = dnsName; + return this; + } + + /** + * Get the ipV4AddressesAndMasks property: IP V4 Addresses and masks for the listener. + * + * @return the ipV4AddressesAndMasks value. + */ + public List ipV4AddressesAndMasks() { + return this.ipV4AddressesAndMasks; + } + + /** + * Set the ipV4AddressesAndMasks property: IP V4 Addresses and masks for the listener. + * + * @param ipV4AddressesAndMasks the ipV4AddressesAndMasks value to set. + * @return the SqlAvailabilityGroupStaticIPListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIPListenerProperties + withIpV4AddressesAndMasks(List ipV4AddressesAndMasks) { + this.ipV4AddressesAndMasks = ipV4AddressesAndMasks; + return this; + } + + /** + * Get the ipV6Addresses property: IP V6 Addresses for the listener. + * + * @return the ipV6Addresses value. + */ + public List ipV6Addresses() { + return this.ipV6Addresses; + } + + /** + * Set the ipV6Addresses property: IP V6 Addresses for the listener. + * + * @param ipV6Addresses the ipV6Addresses value to set. + * @return the SqlAvailabilityGroupStaticIPListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIPListenerProperties withIpV6Addresses(List ipV6Addresses) { + this.ipV6Addresses = ipV6Addresses; + return this; + } + + /** + * Get the port property: Network port for the listener. Default is 1433. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Network port for the listener. Default is 1433. + * + * @param port the port value to set. + * @return the SqlAvailabilityGroupStaticIPListenerProperties object itself. + */ + public SqlAvailabilityGroupStaticIPListenerProperties withPort(Integer port) { + this.port = port; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dnsName", this.dnsName); + jsonWriter.writeArrayField("ipV4AddressesAndMasks", this.ipV4AddressesAndMasks, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("ipV6Addresses", this.ipV6Addresses, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("port", this.port); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlAvailabilityGroupStaticIPListenerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlAvailabilityGroupStaticIPListenerProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlAvailabilityGroupStaticIPListenerProperties. + */ + public static SqlAvailabilityGroupStaticIPListenerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlAvailabilityGroupStaticIPListenerProperties deserializedSqlAvailabilityGroupStaticIPListenerProperties + = new SqlAvailabilityGroupStaticIPListenerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dnsName".equals(fieldName)) { + deserializedSqlAvailabilityGroupStaticIPListenerProperties.dnsName = reader.getString(); + } else if ("ipV4AddressesAndMasks".equals(fieldName)) { + List ipV4AddressesAndMasks + = reader.readArray( + reader1 -> SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.fromJson(reader1)); + deserializedSqlAvailabilityGroupStaticIPListenerProperties.ipV4AddressesAndMasks + = ipV4AddressesAndMasks; + } else if ("ipV6Addresses".equals(fieldName)) { + List ipV6Addresses = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlAvailabilityGroupStaticIPListenerProperties.ipV6Addresses = ipV6Addresses; + } else if ("port".equals(fieldName)) { + deserializedSqlAvailabilityGroupStaticIPListenerProperties.port + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlAvailabilityGroupStaticIPListenerProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java index fbb20e6cf273..20dfff3f0479 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -71,7 +71,7 @@ public interface SqlManagedInstance { SqlManagedInstanceSku sku(); /** - * Gets the systemData property: Read only system data. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -150,7 +150,7 @@ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ WithProperties withExistingResourceGroup(String resourceGroupName); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java index 652040adba86..888bef44a876 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -74,17 +74,6 @@ public SqlManagedInstanceK8SRaw withAdditionalProperties(Map add return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (spec() != null) { - spec().validate(); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java index aed9b1820e34..b60f39f8069f 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -30,6 +30,16 @@ public final class SqlManagedInstanceK8SSpec implements JsonSerializable ad return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (scheduling() != null) { - scheduling().validate(); - } - } - /** * {@inheritDoc} */ @@ -124,6 +163,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeJsonField("scheduling", this.scheduling); jsonWriter.writeNumberField("replicas", this.replicas); + jsonWriter.writeJsonField("security", this.security); + jsonWriter.writeJsonField("settings", this.settings); if (additionalProperties != null) { for (Map.Entry additionalProperty : additionalProperties.entrySet()) { jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); @@ -152,6 +193,10 @@ public static SqlManagedInstanceK8SSpec fromJson(JsonReader jsonReader) throws I deserializedSqlManagedInstanceK8SSpec.scheduling = K8SScheduling.fromJson(reader); } else if ("replicas".equals(fieldName)) { deserializedSqlManagedInstanceK8SSpec.replicas = reader.getNullable(JsonReader::getInt); + } else if ("security".equals(fieldName)) { + deserializedSqlManagedInstanceK8SSpec.security = K8SSecurity.fromJson(reader); + } else if ("settings".equals(fieldName)) { + deserializedSqlManagedInstanceK8SSpec.settings = K8SSettings.fromJson(reader); } else { if (additionalProperties == null) { additionalProperties = new LinkedHashMap<>(); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java index c05ba3694d27..d3289189dbee 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -55,10 +55,15 @@ public final class SqlManagedInstanceProperties implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("provisioningState".equals(fieldName)) { deserializedSqlManagedInstanceProperties.provisioningState = reader.getString(); + } else if ("activeDirectoryInformation".equals(fieldName)) { + deserializedSqlManagedInstanceProperties.activeDirectoryInformation + = ActiveDirectoryInformation.fromJson(reader); } else if ("licenseType".equals(fieldName)) { deserializedSqlManagedInstanceProperties.licenseType = ArcSqlManagedInstanceLicenseType.fromString(reader.getString()); diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java index 2ff8928a43ab..e7e145671bef 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -38,12 +38,12 @@ public final class SqlManagedInstanceSku implements JsonSerializable tags) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java index 404967917350..1f083d2fc54a 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -13,100 +13,100 @@ */ public interface SqlManagedInstances { /** - * List sqlManagedInstance resources in the subscription. + * Retrieves a SQL Managed Instance resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + * @return a SqlManagedInstance along with {@link Response}. */ - PagedIterable list(); + Response getByResourceGroupWithResponse(String resourceGroupName, String sqlManagedInstanceName, + Context context); /** - * List sqlManagedInstance resources in the subscription. + * Retrieves a SQL Managed Instance resource. * - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. + * @return a SqlManagedInstance. */ - PagedIterable list(Context context); + SqlManagedInstance getByResourceGroup(String resourceGroupName, String sqlManagedInstanceName); /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. + * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedIterable}. */ - PagedIterable listByResourceGroup(String resourceGroupName); + void deleteByResourceGroup(String resourceGroupName, String sqlManagedInstanceName); /** - * List sqlManagedInstance resources in the resource group - * - * Gets all sqlManagedInstances in a resource group. + * Deletes a SQL Managed Instance resource. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlManagedInstanceName Name of SQL Managed Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlManagedInstances in a resource group as paginated response with {@link PagedIterable}. */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + void delete(String resourceGroupName, String sqlManagedInstanceName, Context context); /** - * Retrieves a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of SQL Managed Instance. - * @param context The context to associate with this operation. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance along with {@link Response}. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String sqlManagedInstanceName, - Context context); + PagedIterable listByResourceGroup(String resourceGroupName); /** - * Retrieves a SQL Managed Instance resource. + * List sqlManagedInstance resources in the resource group * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName Name of SQL Managed Instance. + * Gets all sqlManagedInstances in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SqlManagedInstance. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - SqlManagedInstance getByResourceGroup(String resourceGroupName, String sqlManagedInstanceName); + PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Deletes a SQL Managed Instance resource. + * List sqlManagedInstance resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. - * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - void deleteByResourceGroup(String resourceGroupName, String sqlManagedInstanceName); + PagedIterable list(); /** - * Deletes a SQL Managed Instance resource. + * List sqlManagedInstance resources in the subscription. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlManagedInstanceName The name of Sql Managed Instances. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlManagedInstance as paginated response with {@link PagedIterable}. */ - void delete(String resourceGroupName, String sqlManagedInstanceName, Context context); + PagedIterable list(Context context); /** * Retrieves a SQL Managed Instance resource. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java new file mode 100644 index 000000000000..c98525109b2a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerAvailabilityGroupResource. + */ +public interface SqlServerAvailabilityGroupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Properties of Arc Sql Server availability group. + * + * @return the properties value. + */ + SqlServerAvailabilityGroupResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner + * object. + * + * @return the inner object. + */ + SqlServerAvailabilityGroupResourceInner innerModel(); + + /** + * The entirety of the SqlServerAvailabilityGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerAvailabilityGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerAvailabilityGroupResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlServerInstanceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlServerInstance(String resourceGroupName, String sqlServerInstanceName); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Server availability group. + * + * @param properties Properties of Arc Sql Server availability group. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerAvailabilityGroupResourceProperties properties); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerAvailabilityGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerAvailabilityGroupResource create(Context context); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + + /** + * Begins update for the SqlServerAvailabilityGroupResource resource. + * + * @return the stage of resource update. + */ + SqlServerAvailabilityGroupResource.Update update(); + + /** + * The template for SqlServerAvailabilityGroupResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerAvailabilityGroupResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerAvailabilityGroupResource apply(Context context); + } + + /** + * The SqlServerAvailabilityGroupResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerAvailabilityGroupResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerAvailabilityGroupResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The Server Availability Group's properties. + * + * @param properties The Server Availability Group's properties. + * @return the next definition stage. + */ + Update withProperties(SqlServerAvailabilityGroupResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerAvailabilityGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerAvailabilityGroupResource refresh(Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response detailViewWithResponse(Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource detailView(); + + /** + * Request manual failover of the availability group to this server. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response failoverWithResponse(Context context); + + /** + * Request manual failover of the availability group to this server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource failover(); + + /** + * Request forced failover of the availability group to this server. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response forceFailoverAllowDataLossWithResponse(Context context); + + /** + * Request forced failover of the availability group to this server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss(); + + /** + * Request adding database(s) to an existing availability group. + * + * @param databases The database names to add to the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response addDatabasesWithResponse(Databases databases, Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param databases The database names to add to the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource addDatabases(Databases databases); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource failoverMiLink(FailoverMiLinkResourceId managedInstanceResourceId); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource failoverMiLink(FailoverMiLinkResourceId managedInstanceResourceId, + Context context); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMiLink(); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMiLink(Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param databases The database names to remove from the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response removeDatabasesWithResponse(Databases databases, Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param databases The database names to remove from the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource removeDatabases(Databases databases); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java new file mode 100644 index 000000000000..459e16703a81 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The properties of Arc Sql Server availability group resource. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourceProperties + implements JsonSerializable { + /* + * ID GUID of the availability group. + */ + private String availabilityGroupId; + + /* + * the SQL server name. + */ + private String serverName; + + /* + * the SQL Server Instance name. + */ + private String instanceName; + + /* + * The unique ID of the hybrid machine that this resource belongs to. + */ + private String vmId; + + /* + * Timestamp for when the data was collected from the client machine. + */ + private OffsetDateTime collectionTimestamp; + + /* + * Availability Group Info + */ + private AvailabilityGroupInfo info; + + /* + * A list of Availability Group Replicas. + */ + private SqlServerAvailabilityGroupResourcePropertiesReplicas replicas; + + /* + * A list of Availability Group Database Replicas. + */ + private SqlServerAvailabilityGroupResourcePropertiesDatabases databases; + + /* + * The provisioning state of the Arc-enabled SQL Server availability group resource. + */ + private String provisioningState; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourceProperties class. + */ + public SqlServerAvailabilityGroupResourceProperties() { + } + + /** + * Get the availabilityGroupId property: ID GUID of the availability group. + * + * @return the availabilityGroupId value. + */ + public String availabilityGroupId() { + return this.availabilityGroupId; + } + + /** + * Get the serverName property: the SQL server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the instanceName property: the SQL Server Instance name. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the vmId property: The unique ID of the hybrid machine that this resource belongs to. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the collectionTimestamp property: Timestamp for when the data was collected from the client machine. + * + * @return the collectionTimestamp value. + */ + public OffsetDateTime collectionTimestamp() { + return this.collectionTimestamp; + } + + /** + * Get the info property: Availability Group Info. + * + * @return the info value. + */ + public AvailabilityGroupInfo info() { + return this.info; + } + + /** + * Set the info property: Availability Group Info. + * + * @param info the info value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties withInfo(AvailabilityGroupInfo info) { + this.info = info; + return this; + } + + /** + * Get the replicas property: A list of Availability Group Replicas. + * + * @return the replicas value. + */ + public SqlServerAvailabilityGroupResourcePropertiesReplicas replicas() { + return this.replicas; + } + + /** + * Set the replicas property: A list of Availability Group Replicas. + * + * @param replicas the replicas value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties + withReplicas(SqlServerAvailabilityGroupResourcePropertiesReplicas replicas) { + this.replicas = replicas; + return this; + } + + /** + * Get the databases property: A list of Availability Group Database Replicas. + * + * @return the databases value. + */ + public SqlServerAvailabilityGroupResourcePropertiesDatabases databases() { + return this.databases; + } + + /** + * Set the databases property: A list of Availability Group Database Replicas. + * + * @param databases the databases value to set. + * @return the SqlServerAvailabilityGroupResourceProperties object itself. + */ + public SqlServerAvailabilityGroupResourceProperties + withDatabases(SqlServerAvailabilityGroupResourcePropertiesDatabases databases) { + this.databases = databases; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server availability group + * resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("info", this.info); + jsonWriter.writeJsonField("replicas", this.replicas); + jsonWriter.writeJsonField("databases", this.databases); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourceProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourceProperties. + */ + public static SqlServerAvailabilityGroupResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourceProperties deserializedSqlServerAvailabilityGroupResourceProperties + = new SqlServerAvailabilityGroupResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("availabilityGroupId".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.availabilityGroupId = reader.getString(); + } else if ("serverName".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.serverName = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.instanceName = reader.getString(); + } else if ("vmId".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.vmId = reader.getString(); + } else if ("collectionTimestamp".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.collectionTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("info".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.info + = AvailabilityGroupInfo.fromJson(reader); + } else if ("replicas".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.replicas + = SqlServerAvailabilityGroupResourcePropertiesReplicas.fromJson(reader); + } else if ("databases".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.databases + = SqlServerAvailabilityGroupResourcePropertiesDatabases.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourceProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java new file mode 100644 index 000000000000..76da726b296e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of Availability Group Database Replicas. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourcePropertiesDatabases + implements JsonSerializable { + /* + * Array of Availability Group Database Replicas. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourcePropertiesDatabases class. + */ + public SqlServerAvailabilityGroupResourcePropertiesDatabases() { + } + + /** + * Get the value property: Array of Availability Group Database Replicas. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Availability Group Database Replicas. + * + * @param value the value value to set. + * @return the SqlServerAvailabilityGroupResourcePropertiesDatabases object itself. + */ + public SqlServerAvailabilityGroupResourcePropertiesDatabases + withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourcePropertiesDatabases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourcePropertiesDatabases if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourcePropertiesDatabases. + */ + public static SqlServerAvailabilityGroupResourcePropertiesDatabases fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourcePropertiesDatabases deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases + = new SqlServerAvailabilityGroupResourcePropertiesDatabases(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader + .readArray(reader1 -> SqlAvailabilityGroupDatabaseReplicaResourceProperties.fromJson(reader1)); + deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourcePropertiesDatabases; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java new file mode 100644 index 000000000000..ad84bb936a52 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of Availability Group Replicas. + */ +@Fluent +public final class SqlServerAvailabilityGroupResourcePropertiesReplicas + implements JsonSerializable { + /* + * Array of Availability Group Replicas. + */ + private List value; + + /* + * Link to retrieve next page of results. + */ + private String nextLink; + + /** + * Creates an instance of SqlServerAvailabilityGroupResourcePropertiesReplicas class. + */ + public SqlServerAvailabilityGroupResourcePropertiesReplicas() { + } + + /** + * Get the value property: Array of Availability Group Replicas. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Availability Group Replicas. + * + * @param value the value value to set. + * @return the SqlServerAvailabilityGroupResourcePropertiesReplicas object itself. + */ + public SqlServerAvailabilityGroupResourcePropertiesReplicas + withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupResourcePropertiesReplicas from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupResourcePropertiesReplicas if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupResourcePropertiesReplicas. + */ + public static SqlServerAvailabilityGroupResourcePropertiesReplicas fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupResourcePropertiesReplicas deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas + = new SqlServerAvailabilityGroupResourcePropertiesReplicas(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SqlAvailabilityGroupReplicaResourceProperties.fromJson(reader1)); + deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupResourcePropertiesReplicas; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java new file mode 100644 index 000000000000..73f1ce325167 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to availability group resource. + */ +@Fluent +public final class SqlServerAvailabilityGroupUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The Server Availability Group's properties + */ + private SqlServerAvailabilityGroupResourceProperties properties; + + /** + * Creates an instance of SqlServerAvailabilityGroupUpdate class. + */ + public SqlServerAvailabilityGroupUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerAvailabilityGroupUpdate object itself. + */ + public SqlServerAvailabilityGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The Server Availability Group's properties. + * + * @return the properties value. + */ + public SqlServerAvailabilityGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Server Availability Group's properties. + * + * @param properties the properties value to set. + * @return the SqlServerAvailabilityGroupUpdate object itself. + */ + public SqlServerAvailabilityGroupUpdate withProperties(SqlServerAvailabilityGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerAvailabilityGroupUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerAvailabilityGroupUpdate if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerAvailabilityGroupUpdate. + */ + public static SqlServerAvailabilityGroupUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerAvailabilityGroupUpdate deserializedSqlServerAvailabilityGroupUpdate + = new SqlServerAvailabilityGroupUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerAvailabilityGroupUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerAvailabilityGroupUpdate.properties + = SqlServerAvailabilityGroupResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerAvailabilityGroupUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java new file mode 100644 index 000000000000..0322b9dfb433 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SqlServerAvailabilityGroups. + */ +public interface SqlServerAvailabilityGroups { + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration); + + /** + * Create a SQL Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createAgConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource createAvailabilityGroup(String resourceGroupName, String sqlServerInstanceName, + AvailabilityGroupCreateUpdateConfiguration createAgConfiguration, Context context); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration); + + /** + * Create a SQL Server distributed availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createDagConfiguration The configuration for the new SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource createDistributedAvailabilityGroup(String resourceGroupName, + String sqlServerInstanceName, DistributedAvailabilityGroupCreateUpdateConfiguration createDagConfiguration, + Context context); + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource createManagedInstanceLink(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration); + + /** + * Create an Managed Instance Link. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param createManagedInstanceLinkConfiguration The configuration for the new Managed Instance Link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource createManagedInstanceLink(String resourceGroupName, String sqlServerInstanceName, + ManagedInstanceLinkCreateUpdateConfiguration createManagedInstanceLinkConfiguration, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Context context); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource get(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the availability group associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response detailViewWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Retrieves detailed properties of the Availability Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource detailView(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response failoverWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request manual failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource failover(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response forceFailoverAllowDataLossWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Context context); + + /** + * Request forced failover of the availability group to this server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource forceFailoverAllowDataLoss(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response addDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request adding database(s) to an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to add to the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource addDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource failoverMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId); + + /** + * Request failover of Arc Sql Server to Azure Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param managedInstanceResourceId The azure resource identifier for the Sql Managed Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerAvailabilityGroupResource failoverMiLink(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, FailoverMiLinkResourceId managedInstanceResourceId, Context context); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName); + + /** + * Deletes the MI Link between an Azure Arc-enabled SQL Server and an Azure SQL Managed Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteMiLink(String resourceGroupName, String sqlServerInstanceName, String availabilityGroupName, + Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response removeDatabasesWithResponse(String resourceGroupName, + String sqlServerInstanceName, String availabilityGroupName, Databases databases, Context context); + + /** + * Request removing database(s) from an existing availability group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupName Name of SQL Availability Group. + * @param databases The database names to remove from the SQL Server availability group resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group. + */ + SqlServerAvailabilityGroupResource removeDatabases(String resourceGroupName, String sqlServerInstanceName, + String availabilityGroupName, Databases databases); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + SqlServerAvailabilityGroupResource getById(String id); + + /** + * Retrieves an Arc Sql Server availability group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server Availability Group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Arc Sql Server availability group resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerAvailabilityGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerAvailabilityGroupResource definition. + */ + SqlServerAvailabilityGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java new file mode 100644 index 000000000000..9dc89e20a1ad --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerDatabaseResource. + */ +public interface SqlServerDatabaseResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Properties of Arc Sql Server database. + * + * @return the properties value. + */ + SqlServerDatabaseResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner object. + * + * @return the inner object. + */ + SqlServerDatabaseResourceInner innerModel(); + + /** + * The entirety of the SqlServerDatabaseResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerDatabaseResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerDatabaseResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerDatabaseResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the SqlServerDatabaseResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, sqlServerInstanceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @return the next definition stage. + */ + WithProperties withExistingSqlServerInstance(String resourceGroupName, String sqlServerInstanceName); + } + + /** + * The stage of the SqlServerDatabaseResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Arc Sql Server database. + * + * @param properties Properties of Arc Sql Server database. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerDatabaseResourceProperties properties); + } + + /** + * The stage of the SqlServerDatabaseResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerDatabaseResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerDatabaseResource create(Context context); + } + + /** + * The stage of the SqlServerDatabaseResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + + /** + * Begins update for the SqlServerDatabaseResource resource. + * + * @return the stage of resource update. + */ + SqlServerDatabaseResource.Update update(); + + /** + * The template for SqlServerDatabaseResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerDatabaseResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerDatabaseResource apply(Context context); + } + + /** + * The SqlServerDatabaseResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerDatabaseResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerDatabaseResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The data controller's properties. + * + * @param properties The data controller's properties. + * @return the next definition stage. + */ + Update withProperties(SqlServerDatabaseResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerDatabaseResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerDatabaseResource refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java new file mode 100644 index 000000000000..30f729a6c637 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java @@ -0,0 +1,635 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The properties of Arc Sql Server database resource. + */ +@Fluent +public final class SqlServerDatabaseResourceProperties + implements JsonSerializable { + /* + * Collation of the database. + */ + private String collationName; + + /* + * Creation date of the database. + */ + private OffsetDateTime databaseCreationDate; + + /* + * Compatibility level of the database + */ + private Integer compatibilityLevel; + + /* + * Size of the database. + */ + private Double sizeMB; + + /* + * Total size in MB for the log (ldf) files for this database. + */ + private Double logFileSizeMB; + + /* + * Total size in MB for the data (mdf and ndf) files for this database. + */ + private Double dataFileSizeMB; + + /* + * Space left of the database. + */ + private Double spaceAvailableMB; + + /* + * State of the database. + */ + private DatabaseState state; + + /* + * Whether the database is read only or not. + */ + private Boolean isReadOnly; + + /* + * Status of the database. + */ + private RecoveryMode recoveryMode; + + /* + * List of features that are enabled for the database + */ + private SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions; + + /* + * The backupInformation property. + */ + private SqlServerDatabaseResourcePropertiesBackupInformation backupInformation; + + /* + * The backup profile for the SQL server. + */ + private BackupPolicy backupPolicy; + + /* + * This records the earliest start date and time that restore is available for this database (ISO8601 format). + */ + private OffsetDateTime earliestRestoreDate; + + /* + * Database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing + * database. sourceDatabaseId and restorePointInTime must be specified. + */ + private DatabaseCreateMode createMode; + + /* + * The name of the source database associated with create operation of this database. + */ + private String sourceDatabaseId; + + /* + * The unique ID of the hybrid machine that this resource belongs to. + */ + private String vmId; + + /* + * Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 + * format) of the source database that will be restored to create the new database. + */ + private OffsetDateTime restorePointInTime; + + /* + * The provisioning state of the Arc-enabled SQL Server database resource. + */ + private String provisioningState; + + /* + * The time when last successful database upload was performed. + */ + private OffsetDateTime lastDatabaseUploadTime; + + /* + * Migration related configuration. + */ + private DataBaseMigration migration; + + /** + * Creates an instance of SqlServerDatabaseResourceProperties class. + */ + public SqlServerDatabaseResourceProperties() { + } + + /** + * Get the collationName property: Collation of the database. + * + * @return the collationName value. + */ + public String collationName() { + return this.collationName; + } + + /** + * Set the collationName property: Collation of the database. + * + * @param collationName the collationName value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withCollationName(String collationName) { + this.collationName = collationName; + return this; + } + + /** + * Get the databaseCreationDate property: Creation date of the database. + * + * @return the databaseCreationDate value. + */ + public OffsetDateTime databaseCreationDate() { + return this.databaseCreationDate; + } + + /** + * Set the databaseCreationDate property: Creation date of the database. + * + * @param databaseCreationDate the databaseCreationDate value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withDatabaseCreationDate(OffsetDateTime databaseCreationDate) { + this.databaseCreationDate = databaseCreationDate; + return this; + } + + /** + * Get the compatibilityLevel property: Compatibility level of the database. + * + * @return the compatibilityLevel value. + */ + public Integer compatibilityLevel() { + return this.compatibilityLevel; + } + + /** + * Set the compatibilityLevel property: Compatibility level of the database. + * + * @param compatibilityLevel the compatibilityLevel value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withCompatibilityLevel(Integer compatibilityLevel) { + this.compatibilityLevel = compatibilityLevel; + return this; + } + + /** + * Get the sizeMB property: Size of the database. + * + * @return the sizeMB value. + */ + public Double sizeMB() { + return this.sizeMB; + } + + /** + * Set the sizeMB property: Size of the database. + * + * @param sizeMB the sizeMB value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withSizeMB(Double sizeMB) { + this.sizeMB = sizeMB; + return this; + } + + /** + * Get the logFileSizeMB property: Total size in MB for the log (ldf) files for this database. + * + * @return the logFileSizeMB value. + */ + public Double logFileSizeMB() { + return this.logFileSizeMB; + } + + /** + * Set the logFileSizeMB property: Total size in MB for the log (ldf) files for this database. + * + * @param logFileSizeMB the logFileSizeMB value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withLogFileSizeMB(Double logFileSizeMB) { + this.logFileSizeMB = logFileSizeMB; + return this; + } + + /** + * Get the dataFileSizeMB property: Total size in MB for the data (mdf and ndf) files for this database. + * + * @return the dataFileSizeMB value. + */ + public Double dataFileSizeMB() { + return this.dataFileSizeMB; + } + + /** + * Set the dataFileSizeMB property: Total size in MB for the data (mdf and ndf) files for this database. + * + * @param dataFileSizeMB the dataFileSizeMB value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withDataFileSizeMB(Double dataFileSizeMB) { + this.dataFileSizeMB = dataFileSizeMB; + return this; + } + + /** + * Get the spaceAvailableMB property: Space left of the database. + * + * @return the spaceAvailableMB value. + */ + public Double spaceAvailableMB() { + return this.spaceAvailableMB; + } + + /** + * Set the spaceAvailableMB property: Space left of the database. + * + * @param spaceAvailableMB the spaceAvailableMB value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withSpaceAvailableMB(Double spaceAvailableMB) { + this.spaceAvailableMB = spaceAvailableMB; + return this; + } + + /** + * Get the state property: State of the database. + * + * @return the state value. + */ + public DatabaseState state() { + return this.state; + } + + /** + * Set the state property: State of the database. + * + * @param state the state value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withState(DatabaseState state) { + this.state = state; + return this; + } + + /** + * Get the isReadOnly property: Whether the database is read only or not. + * + * @return the isReadOnly value. + */ + public Boolean isReadOnly() { + return this.isReadOnly; + } + + /** + * Set the isReadOnly property: Whether the database is read only or not. + * + * @param isReadOnly the isReadOnly value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withIsReadOnly(Boolean isReadOnly) { + this.isReadOnly = isReadOnly; + return this; + } + + /** + * Get the recoveryMode property: Status of the database. + * + * @return the recoveryMode value. + */ + public RecoveryMode recoveryMode() { + return this.recoveryMode; + } + + /** + * Set the recoveryMode property: Status of the database. + * + * @param recoveryMode the recoveryMode value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withRecoveryMode(RecoveryMode recoveryMode) { + this.recoveryMode = recoveryMode; + return this; + } + + /** + * Get the databaseOptions property: List of features that are enabled for the database. + * + * @return the databaseOptions value. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions() { + return this.databaseOptions; + } + + /** + * Set the databaseOptions property: List of features that are enabled for the database. + * + * @param databaseOptions the databaseOptions value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties + withDatabaseOptions(SqlServerDatabaseResourcePropertiesDatabaseOptions databaseOptions) { + this.databaseOptions = databaseOptions; + return this; + } + + /** + * Get the backupInformation property: The backupInformation property. + * + * @return the backupInformation value. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation backupInformation() { + return this.backupInformation; + } + + /** + * Set the backupInformation property: The backupInformation property. + * + * @param backupInformation the backupInformation value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties + withBackupInformation(SqlServerDatabaseResourcePropertiesBackupInformation backupInformation) { + this.backupInformation = backupInformation; + return this; + } + + /** + * Get the backupPolicy property: The backup profile for the SQL server. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The backup profile for the SQL server. + * + * @param backupPolicy the backupPolicy value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the createMode property: Database create mode. PointInTimeRestore: Create a database by restoring a point in + * time backup of an existing database. sourceDatabaseId and restorePointInTime must be specified. + * + * @return the createMode value. + */ + public DatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Database create mode. PointInTimeRestore: Create a database by restoring a point in + * time backup of an existing database. sourceDatabaseId and restorePointInTime must be specified. + * + * @param createMode the createMode value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withCreateMode(DatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the sourceDatabaseId property: The name of the source database associated with create operation of this + * database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId property: The name of the source database associated with create operation of this + * database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the vmId property: The unique ID of the hybrid machine that this resource belongs to. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server database resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastDatabaseUploadTime property: The time when last successful database upload was performed. + * + * @return the lastDatabaseUploadTime value. + */ + public OffsetDateTime lastDatabaseUploadTime() { + return this.lastDatabaseUploadTime; + } + + /** + * Get the migration property: Migration related configuration. + * + * @return the migration value. + */ + public DataBaseMigration migration() { + return this.migration; + } + + /** + * Set the migration property: Migration related configuration. + * + * @param migration the migration value to set. + * @return the SqlServerDatabaseResourceProperties object itself. + */ + public SqlServerDatabaseResourceProperties withMigration(DataBaseMigration migration) { + this.migration = migration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("collationName", this.collationName); + jsonWriter.writeStringField("databaseCreationDate", + this.databaseCreationDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.databaseCreationDate)); + jsonWriter.writeNumberField("compatibilityLevel", this.compatibilityLevel); + jsonWriter.writeNumberField("sizeMB", this.sizeMB); + jsonWriter.writeNumberField("logFileSizeMB", this.logFileSizeMB); + jsonWriter.writeNumberField("dataFileSizeMB", this.dataFileSizeMB); + jsonWriter.writeNumberField("spaceAvailableMB", this.spaceAvailableMB); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeBooleanField("isReadOnly", this.isReadOnly); + jsonWriter.writeStringField("recoveryMode", this.recoveryMode == null ? null : this.recoveryMode.toString()); + jsonWriter.writeJsonField("databaseOptions", this.databaseOptions); + jsonWriter.writeJsonField("backupInformation", this.backupInformation); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeStringField("sourceDatabaseId", this.sourceDatabaseId); + jsonWriter.writeStringField("restorePointInTime", + this.restorePointInTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.restorePointInTime)); + jsonWriter.writeJsonField("migration", this.migration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourceProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourceProperties. + */ + public static SqlServerDatabaseResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourceProperties deserializedSqlServerDatabaseResourceProperties + = new SqlServerDatabaseResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("collationName".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.collationName = reader.getString(); + } else if ("databaseCreationDate".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.databaseCreationDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("compatibilityLevel".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.compatibilityLevel + = reader.getNullable(JsonReader::getInt); + } else if ("sizeMB".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.sizeMB = reader.getNullable(JsonReader::getDouble); + } else if ("logFileSizeMB".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.logFileSizeMB + = reader.getNullable(JsonReader::getDouble); + } else if ("dataFileSizeMB".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.dataFileSizeMB + = reader.getNullable(JsonReader::getDouble); + } else if ("spaceAvailableMB".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.spaceAvailableMB + = reader.getNullable(JsonReader::getDouble); + } else if ("state".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.state + = DatabaseState.fromString(reader.getString()); + } else if ("isReadOnly".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.isReadOnly + = reader.getNullable(JsonReader::getBoolean); + } else if ("recoveryMode".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.recoveryMode + = RecoveryMode.fromString(reader.getString()); + } else if ("databaseOptions".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.databaseOptions + = SqlServerDatabaseResourcePropertiesDatabaseOptions.fromJson(reader); + } else if ("backupInformation".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.backupInformation + = SqlServerDatabaseResourcePropertiesBackupInformation.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("earliestRestoreDate".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.earliestRestoreDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createMode".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.createMode + = DatabaseCreateMode.fromString(reader.getString()); + } else if ("sourceDatabaseId".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.sourceDatabaseId = reader.getString(); + } else if ("vmId".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.vmId = reader.getString(); + } else if ("restorePointInTime".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.restorePointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.provisioningState = reader.getString(); + } else if ("lastDatabaseUploadTime".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.lastDatabaseUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("migration".equals(fieldName)) { + deserializedSqlServerDatabaseResourceProperties.migration = DataBaseMigration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourceProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java new file mode 100644 index 000000000000..6186174ab833 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The SqlServerDatabaseResourcePropertiesBackupInformation model. + */ +@Fluent +public final class SqlServerDatabaseResourcePropertiesBackupInformation + implements JsonSerializable { + /* + * Date time of last full backup. + */ + private OffsetDateTime lastFullBackup; + + /* + * Date time of last log backup. + */ + private OffsetDateTime lastLogBackup; + + /** + * Creates an instance of SqlServerDatabaseResourcePropertiesBackupInformation class. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation() { + } + + /** + * Get the lastFullBackup property: Date time of last full backup. + * + * @return the lastFullBackup value. + */ + public OffsetDateTime lastFullBackup() { + return this.lastFullBackup; + } + + /** + * Set the lastFullBackup property: Date time of last full backup. + * + * @param lastFullBackup the lastFullBackup value to set. + * @return the SqlServerDatabaseResourcePropertiesBackupInformation object itself. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation withLastFullBackup(OffsetDateTime lastFullBackup) { + this.lastFullBackup = lastFullBackup; + return this; + } + + /** + * Get the lastLogBackup property: Date time of last log backup. + * + * @return the lastLogBackup value. + */ + public OffsetDateTime lastLogBackup() { + return this.lastLogBackup; + } + + /** + * Set the lastLogBackup property: Date time of last log backup. + * + * @param lastLogBackup the lastLogBackup value to set. + * @return the SqlServerDatabaseResourcePropertiesBackupInformation object itself. + */ + public SqlServerDatabaseResourcePropertiesBackupInformation withLastLogBackup(OffsetDateTime lastLogBackup) { + this.lastLogBackup = lastLogBackup; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lastFullBackup", + this.lastFullBackup == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastFullBackup)); + jsonWriter.writeStringField("lastLogBackup", + this.lastLogBackup == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastLogBackup)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourcePropertiesBackupInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourcePropertiesBackupInformation if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourcePropertiesBackupInformation. + */ + public static SqlServerDatabaseResourcePropertiesBackupInformation fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourcePropertiesBackupInformation deserializedSqlServerDatabaseResourcePropertiesBackupInformation + = new SqlServerDatabaseResourcePropertiesBackupInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastFullBackup".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesBackupInformation.lastFullBackup = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastLogBackup".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesBackupInformation.lastLogBackup = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourcePropertiesBackupInformation; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java new file mode 100644 index 000000000000..add64d93bd9e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * List of features that are enabled for the database. + */ +@Fluent +public final class SqlServerDatabaseResourcePropertiesDatabaseOptions + implements JsonSerializable { + /* + * The isAutoCloseOn property. + */ + private Boolean isAutoCloseOn; + + /* + * The isAutoShrinkOn property. + */ + private Boolean isAutoShrinkOn; + + /* + * The isAutoCreateStatsOn property. + */ + private Boolean isAutoCreateStatsOn; + + /* + * The isAutoUpdateStatsOn property. + */ + private Boolean isAutoUpdateStatsOn; + + /* + * The isRemoteDataArchiveEnabled property. + */ + private Boolean isRemoteDataArchiveEnabled; + + /* + * The isMemoryOptimizationEnabled property. + */ + private Boolean isMemoryOptimizationEnabled; + + /* + * The isEncrypted property. + */ + private Boolean isEncrypted; + + /* + * The isTrustworthyOn property. + */ + private Boolean isTrustworthyOn; + + /* + * Whether the database uses the In-Memory OLTP feature for storing in-memory objects. + */ + private Boolean isHekatonFilesOn; + + /* + * How many Hekaton files the DB has on disk, if it uses in-memory OLTP objects. + */ + private Integer numberOfHekatonFiles; + + /** + * Creates an instance of SqlServerDatabaseResourcePropertiesDatabaseOptions class. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions() { + } + + /** + * Get the isAutoCloseOn property: The isAutoCloseOn property. + * + * @return the isAutoCloseOn value. + */ + public Boolean isAutoCloseOn() { + return this.isAutoCloseOn; + } + + /** + * Set the isAutoCloseOn property: The isAutoCloseOn property. + * + * @param isAutoCloseOn the isAutoCloseOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoCloseOn(Boolean isAutoCloseOn) { + this.isAutoCloseOn = isAutoCloseOn; + return this; + } + + /** + * Get the isAutoShrinkOn property: The isAutoShrinkOn property. + * + * @return the isAutoShrinkOn value. + */ + public Boolean isAutoShrinkOn() { + return this.isAutoShrinkOn; + } + + /** + * Set the isAutoShrinkOn property: The isAutoShrinkOn property. + * + * @param isAutoShrinkOn the isAutoShrinkOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoShrinkOn(Boolean isAutoShrinkOn) { + this.isAutoShrinkOn = isAutoShrinkOn; + return this; + } + + /** + * Get the isAutoCreateStatsOn property: The isAutoCreateStatsOn property. + * + * @return the isAutoCreateStatsOn value. + */ + public Boolean isAutoCreateStatsOn() { + return this.isAutoCreateStatsOn; + } + + /** + * Set the isAutoCreateStatsOn property: The isAutoCreateStatsOn property. + * + * @param isAutoCreateStatsOn the isAutoCreateStatsOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoCreateStatsOn(Boolean isAutoCreateStatsOn) { + this.isAutoCreateStatsOn = isAutoCreateStatsOn; + return this; + } + + /** + * Get the isAutoUpdateStatsOn property: The isAutoUpdateStatsOn property. + * + * @return the isAutoUpdateStatsOn value. + */ + public Boolean isAutoUpdateStatsOn() { + return this.isAutoUpdateStatsOn; + } + + /** + * Set the isAutoUpdateStatsOn property: The isAutoUpdateStatsOn property. + * + * @param isAutoUpdateStatsOn the isAutoUpdateStatsOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsAutoUpdateStatsOn(Boolean isAutoUpdateStatsOn) { + this.isAutoUpdateStatsOn = isAutoUpdateStatsOn; + return this; + } + + /** + * Get the isRemoteDataArchiveEnabled property: The isRemoteDataArchiveEnabled property. + * + * @return the isRemoteDataArchiveEnabled value. + */ + public Boolean isRemoteDataArchiveEnabled() { + return this.isRemoteDataArchiveEnabled; + } + + /** + * Set the isRemoteDataArchiveEnabled property: The isRemoteDataArchiveEnabled property. + * + * @param isRemoteDataArchiveEnabled the isRemoteDataArchiveEnabled value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions + withIsRemoteDataArchiveEnabled(Boolean isRemoteDataArchiveEnabled) { + this.isRemoteDataArchiveEnabled = isRemoteDataArchiveEnabled; + return this; + } + + /** + * Get the isMemoryOptimizationEnabled property: The isMemoryOptimizationEnabled property. + * + * @return the isMemoryOptimizationEnabled value. + */ + public Boolean isMemoryOptimizationEnabled() { + return this.isMemoryOptimizationEnabled; + } + + /** + * Set the isMemoryOptimizationEnabled property: The isMemoryOptimizationEnabled property. + * + * @param isMemoryOptimizationEnabled the isMemoryOptimizationEnabled value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions + withIsMemoryOptimizationEnabled(Boolean isMemoryOptimizationEnabled) { + this.isMemoryOptimizationEnabled = isMemoryOptimizationEnabled; + return this; + } + + /** + * Get the isEncrypted property: The isEncrypted property. + * + * @return the isEncrypted value. + */ + public Boolean isEncrypted() { + return this.isEncrypted; + } + + /** + * Set the isEncrypted property: The isEncrypted property. + * + * @param isEncrypted the isEncrypted value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + /** + * Get the isTrustworthyOn property: The isTrustworthyOn property. + * + * @return the isTrustworthyOn value. + */ + public Boolean isTrustworthyOn() { + return this.isTrustworthyOn; + } + + /** + * Set the isTrustworthyOn property: The isTrustworthyOn property. + * + * @param isTrustworthyOn the isTrustworthyOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsTrustworthyOn(Boolean isTrustworthyOn) { + this.isTrustworthyOn = isTrustworthyOn; + return this; + } + + /** + * Get the isHekatonFilesOn property: Whether the database uses the In-Memory OLTP feature for storing in-memory + * objects. + * + * @return the isHekatonFilesOn value. + */ + public Boolean isHekatonFilesOn() { + return this.isHekatonFilesOn; + } + + /** + * Set the isHekatonFilesOn property: Whether the database uses the In-Memory OLTP feature for storing in-memory + * objects. + * + * @param isHekatonFilesOn the isHekatonFilesOn value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withIsHekatonFilesOn(Boolean isHekatonFilesOn) { + this.isHekatonFilesOn = isHekatonFilesOn; + return this; + } + + /** + * Get the numberOfHekatonFiles property: How many Hekaton files the DB has on disk, if it uses in-memory OLTP + * objects. + * + * @return the numberOfHekatonFiles value. + */ + public Integer numberOfHekatonFiles() { + return this.numberOfHekatonFiles; + } + + /** + * Set the numberOfHekatonFiles property: How many Hekaton files the DB has on disk, if it uses in-memory OLTP + * objects. + * + * @param numberOfHekatonFiles the numberOfHekatonFiles value to set. + * @return the SqlServerDatabaseResourcePropertiesDatabaseOptions object itself. + */ + public SqlServerDatabaseResourcePropertiesDatabaseOptions withNumberOfHekatonFiles(Integer numberOfHekatonFiles) { + this.numberOfHekatonFiles = numberOfHekatonFiles; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isAutoCloseOn", this.isAutoCloseOn); + jsonWriter.writeBooleanField("isAutoShrinkOn", this.isAutoShrinkOn); + jsonWriter.writeBooleanField("isAutoCreateStatsOn", this.isAutoCreateStatsOn); + jsonWriter.writeBooleanField("isAutoUpdateStatsOn", this.isAutoUpdateStatsOn); + jsonWriter.writeBooleanField("isRemoteDataArchiveEnabled", this.isRemoteDataArchiveEnabled); + jsonWriter.writeBooleanField("isMemoryOptimizationEnabled", this.isMemoryOptimizationEnabled); + jsonWriter.writeBooleanField("isEncrypted", this.isEncrypted); + jsonWriter.writeBooleanField("isTrustworthyOn", this.isTrustworthyOn); + jsonWriter.writeBooleanField("isHekatonFilesOn", this.isHekatonFilesOn); + jsonWriter.writeNumberField("numberOfHekatonFiles", this.numberOfHekatonFiles); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseResourcePropertiesDatabaseOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseResourcePropertiesDatabaseOptions if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseResourcePropertiesDatabaseOptions. + */ + public static SqlServerDatabaseResourcePropertiesDatabaseOptions fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseResourcePropertiesDatabaseOptions deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions + = new SqlServerDatabaseResourcePropertiesDatabaseOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isAutoCloseOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoCloseOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoShrinkOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoShrinkOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoCreateStatsOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoCreateStatsOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isAutoUpdateStatsOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isAutoUpdateStatsOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isRemoteDataArchiveEnabled".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isRemoteDataArchiveEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("isMemoryOptimizationEnabled".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isMemoryOptimizationEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("isEncrypted".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isEncrypted + = reader.getNullable(JsonReader::getBoolean); + } else if ("isTrustworthyOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isTrustworthyOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("isHekatonFilesOn".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.isHekatonFilesOn + = reader.getNullable(JsonReader::getBoolean); + } else if ("numberOfHekatonFiles".equals(fieldName)) { + deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions.numberOfHekatonFiles + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseResourcePropertiesDatabaseOptions; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java new file mode 100644 index 000000000000..64f005ac2fca --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to database resource. + */ +@Fluent +public final class SqlServerDatabaseUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The data controller's properties + */ + private SqlServerDatabaseResourceProperties properties; + + /** + * Creates an instance of SqlServerDatabaseUpdate class. + */ + public SqlServerDatabaseUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerDatabaseUpdate object itself. + */ + public SqlServerDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The data controller's properties. + * + * @return the properties value. + */ + public SqlServerDatabaseResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The data controller's properties. + * + * @param properties the properties value to set. + * @return the SqlServerDatabaseUpdate object itself. + */ + public SqlServerDatabaseUpdate withProperties(SqlServerDatabaseResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerDatabaseUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerDatabaseUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerDatabaseUpdate. + */ + public static SqlServerDatabaseUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerDatabaseUpdate deserializedSqlServerDatabaseUpdate = new SqlServerDatabaseUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerDatabaseUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerDatabaseUpdate.properties + = SqlServerDatabaseResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerDatabaseUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java new file mode 100644 index 000000000000..42ea3860d0fa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SqlServerDatabases. + */ +public interface SqlServerDatabases { + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String sqlServerInstanceName, + String databaseName, Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database. + */ + SqlServerDatabaseResource get(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String sqlServerInstanceName, String databaseName, Context context); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName); + + /** + * List the databases associated with the given Arc Sql Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server database as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String sqlServerInstanceName, + Context context); + + /** + * Retrieves an Arc Sql Server database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + SqlServerDatabaseResource getById(String id); + + /** + * Retrieves an Arc Sql Server database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return arc Sql Server database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Arc Sql Server database resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerDatabaseResource resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerDatabaseResource definition. + */ + SqlServerDatabaseResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java new file mode 100644 index 000000000000..559c10060abb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerEsuLicense. + */ +public interface SqlServerEsuLicense { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: SQL Server ESU license properties. + * + * @return the properties value. + */ + SqlServerEsuLicenseProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner object. + * + * @return the inner object. + */ + SqlServerEsuLicenseInner innerModel(); + + /** + * The entirety of the SqlServerEsuLicense definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerEsuLicense definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerEsuLicense definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerEsuLicense definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the SqlServerEsuLicense definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the SqlServerEsuLicense definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: SQL Server ESU license properties. + * + * @param properties SQL Server ESU license properties. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerEsuLicenseProperties properties); + } + + /** + * The stage of the SqlServerEsuLicense definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerEsuLicense create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerEsuLicense create(Context context); + } + + /** + * The stage of the SqlServerEsuLicense definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + + /** + * Begins update for the SqlServerEsuLicense resource. + * + * @return the stage of resource update. + */ + SqlServerEsuLicense.Update update(); + + /** + * The template for SqlServerEsuLicense update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerEsuLicense apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerEsuLicense apply(Context context); + } + + /** + * The SqlServerEsuLicense update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerEsuLicense update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerEsuLicense update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + Update withProperties(SqlServerEsuLicenseUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerEsuLicense refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerEsuLicense refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java new file mode 100644 index 000000000000..8ffabe40d6c5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of SQL Server ESU license. + */ +@Fluent +public final class SqlServerEsuLicenseProperties implements JsonSerializable { + /* + * SQL Server ESU license type. + */ + private BillingPlan billingPlan; + + /* + * The SQL Server version the license covers. + */ + private Version version; + + /* + * The unique ID of this license. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + */ + private String uniqueId; + + /* + * The number of total cores of the license covers. + */ + private int physicalCores; + + /* + * The activation state of the license. + */ + private State activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime activatedAt; + + /* + * The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime terminatedAt; + + /* + * The tenantId the SQL Server ESU license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerEsuLicenseProperties class. + */ + public SqlServerEsuLicenseProperties() { + } + + /** + * Get the billingPlan property: SQL Server ESU license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server ESU license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the version property: The SQL Server version the license covers. + * + * @return the version value. + */ + public Version version() { + return this.version; + } + + /** + * Set the version property: The SQL Server version the license covers. + * + * @param version the version value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withVersion(Version version) { + this.version = version; + return this; + } + + /** + * Get the uniqueId property: The unique ID of this license. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public int physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withPhysicalCores(int physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public State activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withActivationState(State activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerEsuLicenseProperties object itself. + */ + public SqlServerEsuLicenseProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the activatedAt property: The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the activatedAt value. + */ + public OffsetDateTime activatedAt() { + return this.activatedAt; + } + + /** + * Get the terminatedAt property: The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the terminatedAt value. + */ + public OffsetDateTime terminatedAt() { + return this.terminatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server ESU license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeIntField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseProperties. + */ + public static SqlServerEsuLicenseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseProperties deserializedSqlServerEsuLicenseProperties + = new SqlServerEsuLicenseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.billingPlan = BillingPlan.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.version = Version.fromString(reader.getString()); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.physicalCores = reader.getInt(); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.activationState = State.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.scopeType = ScopeType.fromString(reader.getString()); + } else if ("uniqueId".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.uniqueId = reader.getString(); + } else if ("activatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.activatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("terminatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.terminatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerEsuLicenseProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java new file mode 100644 index 000000000000..23eb9d905efb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to a SQL Server ESU license resource. + */ +@Fluent +public final class SqlServerEsuLicenseUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * null + */ + private SqlServerEsuLicenseUpdateProperties properties; + + /** + * Creates an instance of SqlServerEsuLicenseUpdate class. + */ + public SqlServerEsuLicenseUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerEsuLicenseUpdate object itself. + */ + public SqlServerEsuLicenseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlServerEsuLicenseUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the SqlServerEsuLicenseUpdate object itself. + */ + public SqlServerEsuLicenseUpdate withProperties(SqlServerEsuLicenseUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseUpdate if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseUpdate. + */ + public static SqlServerEsuLicenseUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseUpdate deserializedSqlServerEsuLicenseUpdate = new SqlServerEsuLicenseUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerEsuLicenseUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdate.properties + = SqlServerEsuLicenseUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.java new file mode 100644 index 000000000000..7e6d5e2a980a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of update SqlServerEsuLicense. + */ +@Fluent +public final class SqlServerEsuLicenseUpdateProperties + implements JsonSerializable { + /* + * SQL Server ESU license type. + */ + private BillingPlan billingPlan; + + /* + * The SQL Server version the license covers. + */ + private Version version; + + /* + * The unique ID of this license. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + */ + private String uniqueId; + + /* + * The number of total cores of the license covers. + */ + private Integer physicalCores; + + /* + * The activation state of the license. + */ + private State activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime activatedAt; + + /* + * The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time format. + */ + private OffsetDateTime terminatedAt; + + /* + * The tenantId the SQL Server ESU license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerEsuLicenseUpdateProperties class. + */ + public SqlServerEsuLicenseUpdateProperties() { + } + + /** + * Get the billingPlan property: SQL Server ESU license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server ESU license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the version property: The SQL Server version the license covers. + * + * @return the version value. + */ + public Version version() { + return this.version; + } + + /** + * Set the version property: The SQL Server version the license covers. + * + * @param version the version value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withVersion(Version version) { + this.version = version; + return this; + } + + /** + * Get the uniqueId property: The unique ID of this license. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public Integer physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withPhysicalCores(Integer physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public State activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withActivationState(State activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerEsuLicenseUpdateProperties object itself. + */ + public SqlServerEsuLicenseUpdateProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the activatedAt property: The timestamp of the activation of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the activatedAt value. + */ + public OffsetDateTime activatedAt() { + return this.activatedAt; + } + + /** + * Get the terminatedAt property: The timestamp of the termination of the SqlServerEsuLicense in ISO 8601 date-time + * format. + * + * @return the terminatedAt value. + */ + public OffsetDateTime terminatedAt() { + return this.terminatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server ESU license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeNumberField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerEsuLicenseUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerEsuLicenseUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerEsuLicenseUpdateProperties. + */ + public static SqlServerEsuLicenseUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerEsuLicenseUpdateProperties deserializedSqlServerEsuLicenseUpdateProperties + = new SqlServerEsuLicenseUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.billingPlan + = BillingPlan.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.version = Version.fromString(reader.getString()); + } else if ("uniqueId".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.uniqueId = reader.getString(); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.physicalCores + = reader.getNullable(JsonReader::getInt); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.activationState + = State.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.scopeType + = ScopeType.fromString(reader.getString()); + } else if ("activatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.activatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("terminatedAt".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.terminatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerEsuLicenseUpdateProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerEsuLicenseUpdateProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java new file mode 100644 index 000000000000..59639f4de0f1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SqlServerEsuLicenses. + */ +public interface SqlServerEsuLicenses { + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String sqlServerEsuLicenseName, Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource. + */ + SqlServerEsuLicense getByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerEsuLicenseName, + Context context); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerEsuLicenseName Name of SQL Server ESU License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String sqlServerEsuLicenseName); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerEsuLicense resources in the resource group + * + * Gets all sqlServerEsuLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List sqlServerEsuLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server ESU licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + SqlServerEsuLicense getById(String id); + + /** + * Retrieves a SQL Server ESU license resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server ESU license resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a SQL Server ESU license resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerEsuLicense resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerEsuLicense definition. + */ + SqlServerEsuLicense.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java index 8f7e950cb3b5..7378bfb3cd59 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java @@ -1,13 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; +import java.util.List; import java.util.Map; /** @@ -57,7 +60,7 @@ public interface SqlServerInstance { SqlServerInstanceProperties properties(); /** - * Gets the systemData property: Read only system data. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -136,7 +139,7 @@ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ WithCreate withExistingResourceGroup(String resourceGroupName); @@ -200,7 +203,7 @@ interface WithProperties { /** * The template for SqlServerInstance update. */ - interface Update extends UpdateStages.WithTags { + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { /** * Executes the update request. * @@ -233,6 +236,19 @@ interface WithTags { */ Update withTags(Map tags); } + + /** + * The stage of the SqlServerInstance update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + Update withProperties(SqlServerInstanceUpdateProperties properties); + } } /** @@ -249,4 +265,358 @@ interface WithTags { * @return the refreshed resource. */ SqlServerInstance refresh(Context context); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getTelemetry(SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, + Context context); + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getBestPracticesAssessment(SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest); + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getBestPracticesAssessment(SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, + Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + Response runMigrationAssessmentWithResponse(Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment(); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob(); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob( + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports(); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports( + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(Context context); + + /** + * The request to run SQL best practices assessment. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment along with {@link Response}. + */ + Response + runBestPracticesAssessmentWithResponse(Context context); + + /** + * The request to run SQL best practices assessment. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment. + */ + SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticesAssessment(); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(Context context); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunMigrationReadinessAssessmentResponse runMigrationReadinessAssessment(); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunMigrationReadinessAssessmentResponse runMigrationReadinessAssessment(Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + Response getJobsStatusWithResponse( + SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + SqlServerInstanceJobsStatusResponse getJobsStatus(); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + SqlServerInstanceJobsResponse getJobs(); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + SqlServerInstanceJobsResponse getJobs(SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + Response preUpgradeWithResponse(Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance preUpgrade(); + + /** + * Clean up after upgrading. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. + */ + Response postUpgradeWithResponse(Context context); + + /** + * Clean up after upgrading. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance postUpgrade(); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment( + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment( + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context); + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable getAllAvailabilityGroups(); + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable + getAllAvailabilityGroups(AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, Context context); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumn.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumn.java new file mode 100644 index 000000000000..db90c0e278eb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumn.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SQL best practices assessment result column. + */ +@Immutable +public final class SqlServerInstanceBpaColumn implements JsonSerializable { + /* + * The name of the result column. + */ + private String name; + + /* + * The type of the result column. + */ + private SqlServerInstanceBpaColumnType type; + + /** + * Creates an instance of SqlServerInstanceBpaColumn class. + */ + private SqlServerInstanceBpaColumn() { + } + + /** + * Get the name property: The name of the result column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the result column. + * + * @return the type value. + */ + public SqlServerInstanceBpaColumnType type() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceBpaColumn from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceBpaColumn if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceBpaColumn. + */ + public static SqlServerInstanceBpaColumn fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceBpaColumn deserializedSqlServerInstanceBpaColumn = new SqlServerInstanceBpaColumn(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSqlServerInstanceBpaColumn.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerInstanceBpaColumn.type + = SqlServerInstanceBpaColumnType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceBpaColumn; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumnType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumnType.java new file mode 100644 index 000000000000..840d7fc28939 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumnType.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the result column. + */ +public final class SqlServerInstanceBpaColumnType extends ExpandableStringEnum { + /** + * bool. + */ + public static final SqlServerInstanceBpaColumnType BOOL = fromString("bool"); + + /** + * datetime. + */ + public static final SqlServerInstanceBpaColumnType DATETIME = fromString("datetime"); + + /** + * int. + */ + public static final SqlServerInstanceBpaColumnType INT = fromString("int"); + + /** + * long. + */ + public static final SqlServerInstanceBpaColumnType LONG = fromString("long"); + + /** + * double. + */ + public static final SqlServerInstanceBpaColumnType DOUBLE = fromString("double"); + + /** + * string. + */ + public static final SqlServerInstanceBpaColumnType STRING = fromString("string"); + + /** + * guid. + */ + public static final SqlServerInstanceBpaColumnType GUID = fromString("guid"); + + /** + * timespan. + */ + public static final SqlServerInstanceBpaColumnType TIMESPAN = fromString("timespan"); + + /** + * Creates a new instance of SqlServerInstanceBpaColumnType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SqlServerInstanceBpaColumnType() { + } + + /** + * Creates or finds a SqlServerInstanceBpaColumnType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlServerInstanceBpaColumnType. + */ + public static SqlServerInstanceBpaColumnType fromString(String name) { + return fromString(name, SqlServerInstanceBpaColumnType.class); + } + + /** + * Gets known SqlServerInstanceBpaColumnType values. + * + * @return known SqlServerInstanceBpaColumnType values. + */ + public static Collection values() { + return values(SqlServerInstanceBpaColumnType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaQueryType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaQueryType.java new file mode 100644 index 000000000000..161a4f8eb5c8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaQueryType.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of query to run for summarizing the best practices assessment results. If not specified, the default is + * 'Basic'. + */ +public final class SqlServerInstanceBpaQueryType extends ExpandableStringEnum { + /** + * Basic. + */ + public static final SqlServerInstanceBpaQueryType BASIC = fromString("Basic"); + + /** + * HistoricalTrends. + */ + public static final SqlServerInstanceBpaQueryType HISTORICAL_TRENDS = fromString("HistoricalTrends"); + + /** + * Creates a new instance of SqlServerInstanceBpaQueryType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SqlServerInstanceBpaQueryType() { + } + + /** + * Creates or finds a SqlServerInstanceBpaQueryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlServerInstanceBpaQueryType. + */ + public static SqlServerInstanceBpaQueryType fromString(String name) { + return fromString(name, SqlServerInstanceBpaQueryType.class); + } + + /** + * Gets known SqlServerInstanceBpaQueryType values. + * + * @return known SqlServerInstanceBpaQueryType values. + */ + public static Collection values() { + return values(SqlServerInstanceBpaQueryType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaReportType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaReportType.java new file mode 100644 index 000000000000..e2e531fcd6e3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaReportType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The report type that needs to be fetched. If not specified, the default is AssessmentSummary. + */ +public final class SqlServerInstanceBpaReportType extends ExpandableStringEnum { + /** + * AssessmentDataPoint. + */ + public static final SqlServerInstanceBpaReportType ASSESSMENT_DATA_POINT = fromString("AssessmentDataPoint"); + + /** + * AssessmentSummary. + */ + public static final SqlServerInstanceBpaReportType ASSESSMENT_SUMMARY = fromString("AssessmentSummary"); + + /** + * Creates a new instance of SqlServerInstanceBpaReportType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SqlServerInstanceBpaReportType() { + } + + /** + * Creates or finds a SqlServerInstanceBpaReportType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlServerInstanceBpaReportType. + */ + public static SqlServerInstanceBpaReportType fromString(String name) { + return fromString(name, SqlServerInstanceBpaReportType.class); + } + + /** + * Gets known SqlServerInstanceBpaReportType values. + * + * @return known SqlServerInstanceBpaReportType values. + */ + public static Collection values() { + return values(SqlServerInstanceBpaReportType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaRequest.java new file mode 100644 index 000000000000..12da29e7f328 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaRequest.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request for retrieving SQL best practices assessment results. + */ +@Fluent +public final class SqlServerInstanceBpaRequest implements JsonSerializable { + /* + * The report type that needs to be fetched. If not specified, the default is AssessmentSummary. + */ + private SqlServerInstanceBpaReportType reportType; + + /* + * The GUID of the report to return best practices assessment results for. If not specified, summaries for all + * reports will be returned. + */ + private String reportId; + + /* + * The opaque token to use to skip to a specific page of the report. If not specified, the first page will be + * returned. + */ + private String skipToken; + + /* + * The type of query to run for summarizing the best practices assessment results. If not specified, the default is + * 'Basic'. + */ + private SqlServerInstanceBpaQueryType queryType; + + /** + * Creates an instance of SqlServerInstanceBpaRequest class. + */ + public SqlServerInstanceBpaRequest() { + } + + /** + * Get the reportType property: The report type that needs to be fetched. If not specified, the default is + * AssessmentSummary. + * + * @return the reportType value. + */ + public SqlServerInstanceBpaReportType reportType() { + return this.reportType; + } + + /** + * Set the reportType property: The report type that needs to be fetched. If not specified, the default is + * AssessmentSummary. + * + * @param reportType the reportType value to set. + * @return the SqlServerInstanceBpaRequest object itself. + */ + public SqlServerInstanceBpaRequest withReportType(SqlServerInstanceBpaReportType reportType) { + this.reportType = reportType; + return this; + } + + /** + * Get the reportId property: The GUID of the report to return best practices assessment results for. If not + * specified, summaries for all reports will be returned. + * + * @return the reportId value. + */ + public String reportId() { + return this.reportId; + } + + /** + * Set the reportId property: The GUID of the report to return best practices assessment results for. If not + * specified, summaries for all reports will be returned. + * + * @param reportId the reportId value to set. + * @return the SqlServerInstanceBpaRequest object itself. + */ + public SqlServerInstanceBpaRequest withReportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Get the skipToken property: The opaque token to use to skip to a specific page of the report. If not specified, + * the first page will be returned. + * + * @return the skipToken value. + */ + public String skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: The opaque token to use to skip to a specific page of the report. If not specified, + * the first page will be returned. + * + * @param skipToken the skipToken value to set. + * @return the SqlServerInstanceBpaRequest object itself. + */ + public SqlServerInstanceBpaRequest withSkipToken(String skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Get the queryType property: The type of query to run for summarizing the best practices assessment results. If + * not specified, the default is 'Basic'. + * + * @return the queryType value. + */ + public SqlServerInstanceBpaQueryType queryType() { + return this.queryType; + } + + /** + * Set the queryType property: The type of query to run for summarizing the best practices assessment results. If + * not specified, the default is 'Basic'. + * + * @param queryType the queryType value to set. + * @return the SqlServerInstanceBpaRequest object itself. + */ + public SqlServerInstanceBpaRequest withQueryType(SqlServerInstanceBpaQueryType queryType) { + this.queryType = queryType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("reportType", this.reportType == null ? null : this.reportType.toString()); + jsonWriter.writeStringField("reportId", this.reportId); + jsonWriter.writeStringField("skipToken", this.skipToken); + jsonWriter.writeStringField("queryType", this.queryType == null ? null : this.queryType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceBpaRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceBpaRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceBpaRequest. + */ + public static SqlServerInstanceBpaRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceBpaRequest deserializedSqlServerInstanceBpaRequest = new SqlServerInstanceBpaRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reportType".equals(fieldName)) { + deserializedSqlServerInstanceBpaRequest.reportType + = SqlServerInstanceBpaReportType.fromString(reader.getString()); + } else if ("reportId".equals(fieldName)) { + deserializedSqlServerInstanceBpaRequest.reportId = reader.getString(); + } else if ("skipToken".equals(fieldName)) { + deserializedSqlServerInstanceBpaRequest.skipToken = reader.getString(); + } else if ("queryType".equals(fieldName)) { + deserializedSqlServerInstanceBpaRequest.queryType + = SqlServerInstanceBpaQueryType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceBpaRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJob.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJob.java new file mode 100644 index 000000000000..78ffac646cc5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJob.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The job running on the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceJob implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceJob class. + */ + private SqlServerInstanceJob() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJob if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJob. + */ + public static SqlServerInstanceJob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJob deserializedSqlServerInstanceJob = new SqlServerInstanceJob(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceJob.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceJob.instanceName = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceJob.jobStatus = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceJob.jobException = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceJob.backgroundJob = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceJob.sequencerActions = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJob; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java new file mode 100644 index 000000000000..1330b3ebee1e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The status of the job running on the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceJobStatus implements JsonSerializable { + /* + * The unique identifier of the job. + */ + private String id; + + /* + * The name of the SQL Server instance. + */ + private String instanceName; + + /* + * The status of the job. + */ + private JobStatus jobStatus; + + /* + * The exception message if the job failed. + */ + private String jobException; + + /* + * The background job details. + */ + private BackgroundJob backgroundJob; + + /* + * The list of sequencer actions. + */ + private List sequencerActions; + + /** + * Creates an instance of SqlServerInstanceJobStatus class. + */ + private SqlServerInstanceJobStatus() { + } + + /** + * Get the id property: The unique identifier of the job. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + public JobStatus jobStatus() { + return this.jobStatus; + } + + /** + * Get the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + public String jobException() { + return this.jobException; + } + + /** + * Get the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + public BackgroundJob backgroundJob() { + return this.backgroundJob; + } + + /** + * Get the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + public List sequencerActions() { + return this.sequencerActions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("jobStatus", this.jobStatus == null ? null : this.jobStatus.toString()); + jsonWriter.writeStringField("jobException", this.jobException); + jsonWriter.writeJsonField("backgroundJob", this.backgroundJob); + jsonWriter.writeArrayField("sequencerActions", this.sequencerActions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobStatus if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobStatus. + */ + public static SqlServerInstanceJobStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobStatus deserializedSqlServerInstanceJobStatus = new SqlServerInstanceJobStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.id = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.instanceName = reader.getString(); + } else if ("jobStatus".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.jobStatus = JobStatus.fromString(reader.getString()); + } else if ("jobException".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.jobException = reader.getString(); + } else if ("backgroundJob".equals(fieldName)) { + deserializedSqlServerInstanceJobStatus.backgroundJob = BackgroundJob.fromJson(reader); + } else if ("sequencerActions".equals(fieldName)) { + List sequencerActions + = reader.readArray(reader1 -> SequencerAction.fromJson(reader1)); + deserializedSqlServerInstanceJobStatus.sequencerActions = sequencerActions; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobStatus; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsRequest.java new file mode 100644 index 000000000000..4137c5f4d742 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsRequest.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request for the jobs running on the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceJobsRequest implements JsonSerializable { + /* + * The name of the feature to retrieve the jobs for. + */ + private String featureName; + + /* + * The type of the job to retrieve the jobs for. + */ + private String jobType; + + /** + * Creates an instance of SqlServerInstanceJobsRequest class. + */ + public SqlServerInstanceJobsRequest() { + } + + /** + * Get the featureName property: The name of the feature to retrieve the jobs for. + * + * @return the featureName value. + */ + public String featureName() { + return this.featureName; + } + + /** + * Set the featureName property: The name of the feature to retrieve the jobs for. + * + * @param featureName the featureName value to set. + * @return the SqlServerInstanceJobsRequest object itself. + */ + public SqlServerInstanceJobsRequest withFeatureName(String featureName) { + this.featureName = featureName; + return this; + } + + /** + * Get the jobType property: The type of the job to retrieve the jobs for. + * + * @return the jobType value. + */ + public String jobType() { + return this.jobType; + } + + /** + * Set the jobType property: The type of the job to retrieve the jobs for. + * + * @param jobType the jobType value to set. + * @return the SqlServerInstanceJobsRequest object itself. + */ + public SqlServerInstanceJobsRequest withJobType(String jobType) { + this.jobType = jobType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureName", this.featureName); + jsonWriter.writeStringField("jobType", this.jobType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobsRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobsRequest. + */ + public static SqlServerInstanceJobsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobsRequest deserializedSqlServerInstanceJobsRequest = new SqlServerInstanceJobsRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureName".equals(fieldName)) { + deserializedSqlServerInstanceJobsRequest.featureName = reader.getString(); + } else if ("jobType".equals(fieldName)) { + deserializedSqlServerInstanceJobsRequest.jobType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobsRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsResponse.java new file mode 100644 index 000000000000..6ab6c5c32727 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceJobsResponse. + */ +public interface SqlServerInstanceJobsResponse { + /** + * Gets the jobs property: The list of jobs running on the SQL Server instance. + * + * @return the jobs value. + */ + List jobs(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner object. + * + * @return the inner object. + */ + SqlServerInstanceJobsResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java new file mode 100644 index 000000000000..2a814d2b22b4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request for the status of the jobs running on the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceJobsStatusRequest implements JsonSerializable { + /* + * The name of the feature to retrieve the job status for. + */ + private String featureName; + + /* + * The type of the job to retrieve the status for. + */ + private String jobType; + + /** + * Creates an instance of SqlServerInstanceJobsStatusRequest class. + */ + public SqlServerInstanceJobsStatusRequest() { + } + + /** + * Get the featureName property: The name of the feature to retrieve the job status for. + * + * @return the featureName value. + */ + public String featureName() { + return this.featureName; + } + + /** + * Set the featureName property: The name of the feature to retrieve the job status for. + * + * @param featureName the featureName value to set. + * @return the SqlServerInstanceJobsStatusRequest object itself. + */ + public SqlServerInstanceJobsStatusRequest withFeatureName(String featureName) { + this.featureName = featureName; + return this; + } + + /** + * Get the jobType property: The type of the job to retrieve the status for. + * + * @return the jobType value. + */ + public String jobType() { + return this.jobType; + } + + /** + * Set the jobType property: The type of the job to retrieve the status for. + * + * @param jobType the jobType value to set. + * @return the SqlServerInstanceJobsStatusRequest object itself. + */ + public SqlServerInstanceJobsStatusRequest withJobType(String jobType) { + this.jobType = jobType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("featureName", this.featureName); + jsonWriter.writeStringField("jobType", this.jobType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceJobsStatusRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceJobsStatusRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceJobsStatusRequest. + */ + public static SqlServerInstanceJobsStatusRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceJobsStatusRequest deserializedSqlServerInstanceJobsStatusRequest + = new SqlServerInstanceJobsStatusRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("featureName".equals(fieldName)) { + deserializedSqlServerInstanceJobsStatusRequest.featureName = reader.getString(); + } else if ("jobType".equals(fieldName)) { + deserializedSqlServerInstanceJobsStatusRequest.jobType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceJobsStatusRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java new file mode 100644 index 000000000000..9739328e0c73 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceJobsStatusResponse. + */ +public interface SqlServerInstanceJobsStatusResponse { + /** + * Gets the jobsStatus property: The list of jobs status running on the SQL Server instance. + * + * @return the jobsStatus value. + */ + List jobsStatus(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceJobsStatusResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessment.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessment.java new file mode 100644 index 000000000000..f9524747b797 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessment.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The status of an individual requirement for MI Link. + */ +@Immutable +public final class SqlServerInstanceManagedInstanceLinkAssessment + implements JsonSerializable { + /* + * The name of the requirement. + */ + private String name; + + /* + * Validation category for the MI Link prerequisites assessment. + */ + private MiLinkAssessmentCategory category; + + /* + * The status of the requirement. + */ + private AssessmentStatus status; + + /* + * The information text about requirement. + */ + private String information; + + /* + * Additional details about the check, including any recommended actions. + */ + private String additionalInformation; + + /* + * List of names of databases that are failing the given assessment. + */ + private List failingDbs; + + /** + * Creates an instance of SqlServerInstanceManagedInstanceLinkAssessment class. + */ + private SqlServerInstanceManagedInstanceLinkAssessment() { + } + + /** + * Get the name property: The name of the requirement. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the category property: Validation category for the MI Link prerequisites assessment. + * + * @return the category value. + */ + public MiLinkAssessmentCategory category() { + return this.category; + } + + /** + * Get the status property: The status of the requirement. + * + * @return the status value. + */ + public AssessmentStatus status() { + return this.status; + } + + /** + * Get the information property: The information text about requirement. + * + * @return the information value. + */ + public String information() { + return this.information; + } + + /** + * Get the additionalInformation property: Additional details about the check, including any recommended actions. + * + * @return the additionalInformation value. + */ + public String additionalInformation() { + return this.additionalInformation; + } + + /** + * Get the failingDbs property: List of names of databases that are failing the given assessment. + * + * @return the failingDbs value. + */ + public List failingDbs() { + return this.failingDbs; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("information", this.information); + jsonWriter.writeStringField("additionalInformation", this.additionalInformation); + jsonWriter.writeArrayField("failingDbs", this.failingDbs, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceManagedInstanceLinkAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceManagedInstanceLinkAssessment if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceManagedInstanceLinkAssessment. + */ + public static SqlServerInstanceManagedInstanceLinkAssessment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceManagedInstanceLinkAssessment deserializedSqlServerInstanceManagedInstanceLinkAssessment + = new SqlServerInstanceManagedInstanceLinkAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessment.name = reader.getString(); + } else if ("category".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessment.category + = MiLinkAssessmentCategory.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessment.status + = AssessmentStatus.fromString(reader.getString()); + } else if ("information".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessment.information = reader.getString(); + } else if ("additionalInformation".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessment.additionalInformation + = reader.getString(); + } else if ("failingDbs".equals(fieldName)) { + List failingDbs = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlServerInstanceManagedInstanceLinkAssessment.failingDbs = failingDbs; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceManagedInstanceLinkAssessment; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentRequest.java new file mode 100644 index 000000000000..cb7111ce4930 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentRequest.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The MI Link assessment request for the SQL Server instance. + */ +@Fluent +public final class SqlServerInstanceManagedInstanceLinkAssessmentRequest + implements JsonSerializable { + /* + * The Azure SQL Managed Instance resource ID to link with the SQL Server instance. + */ + private String azureManagedInstanceResourceId; + + /* + * The role of managed instance in a distributed availability group, can be Primary or Secondary. + */ + private AzureManagedInstanceRole azureManagedInstanceRole; + + /* + * An array of strings, where each value represents the name of a database to be replicated to the Azure SQL Managed + * Instance. + */ + private List databaseNames; + + /* + * The name of the availability group to be used for the database replication. + */ + private String availabilityGroupName; + + /* + * The name of the DAG to be used for the database replication. Also referred to as Link Name. + */ + private String distributedAvailabilityGroupName; + + /* + * An array of strings, where each value represents the category of the assessment to be run. If this field is not + * provided, all assessment categories will be run. + */ + private List assessmentCategories; + + /* + * The IP address of the SQL Server instance. + */ + private String sqlServerIpAddress; + + /** + * Creates an instance of SqlServerInstanceManagedInstanceLinkAssessmentRequest class. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest() { + } + + /** + * Get the azureManagedInstanceResourceId property: The Azure SQL Managed Instance resource ID to link with the SQL + * Server instance. + * + * @return the azureManagedInstanceResourceId value. + */ + public String azureManagedInstanceResourceId() { + return this.azureManagedInstanceResourceId; + } + + /** + * Set the azureManagedInstanceResourceId property: The Azure SQL Managed Instance resource ID to link with the SQL + * Server instance. + * + * @param azureManagedInstanceResourceId the azureManagedInstanceResourceId value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest + withAzureManagedInstanceResourceId(String azureManagedInstanceResourceId) { + this.azureManagedInstanceResourceId = azureManagedInstanceResourceId; + return this; + } + + /** + * Get the azureManagedInstanceRole property: The role of managed instance in a distributed availability group, can + * be Primary or Secondary. + * + * @return the azureManagedInstanceRole value. + */ + public AzureManagedInstanceRole azureManagedInstanceRole() { + return this.azureManagedInstanceRole; + } + + /** + * Set the azureManagedInstanceRole property: The role of managed instance in a distributed availability group, can + * be Primary or Secondary. + * + * @param azureManagedInstanceRole the azureManagedInstanceRole value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest + withAzureManagedInstanceRole(AzureManagedInstanceRole azureManagedInstanceRole) { + this.azureManagedInstanceRole = azureManagedInstanceRole; + return this; + } + + /** + * Get the databaseNames property: An array of strings, where each value represents the name of a database to be + * replicated to the Azure SQL Managed Instance. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.databaseNames; + } + + /** + * Set the databaseNames property: An array of strings, where each value represents the name of a database to be + * replicated to the Azure SQL Managed Instance. + * + * @param databaseNames the databaseNames value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest withDatabaseNames(List databaseNames) { + this.databaseNames = databaseNames; + return this; + } + + /** + * Get the availabilityGroupName property: The name of the availability group to be used for the database + * replication. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: The name of the availability group to be used for the database + * replication. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest + withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the distributedAvailabilityGroupName property: The name of the DAG to be used for the database replication. + * Also referred to as Link Name. + * + * @return the distributedAvailabilityGroupName value. + */ + public String distributedAvailabilityGroupName() { + return this.distributedAvailabilityGroupName; + } + + /** + * Set the distributedAvailabilityGroupName property: The name of the DAG to be used for the database replication. + * Also referred to as Link Name. + * + * @param distributedAvailabilityGroupName the distributedAvailabilityGroupName value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest + withDistributedAvailabilityGroupName(String distributedAvailabilityGroupName) { + this.distributedAvailabilityGroupName = distributedAvailabilityGroupName; + return this; + } + + /** + * Get the assessmentCategories property: An array of strings, where each value represents the category of the + * assessment to be run. If this field is not provided, all assessment categories will be run. + * + * @return the assessmentCategories value. + */ + public List assessmentCategories() { + return this.assessmentCategories; + } + + /** + * Set the assessmentCategories property: An array of strings, where each value represents the category of the + * assessment to be run. If this field is not provided, all assessment categories will be run. + * + * @param assessmentCategories the assessmentCategories value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest + withAssessmentCategories(List assessmentCategories) { + this.assessmentCategories = assessmentCategories; + return this; + } + + /** + * Get the sqlServerIpAddress property: The IP address of the SQL Server instance. + * + * @return the sqlServerIpAddress value. + */ + public String sqlServerIpAddress() { + return this.sqlServerIpAddress; + } + + /** + * Set the sqlServerIpAddress property: The IP address of the SQL Server instance. + * + * @param sqlServerIpAddress the sqlServerIpAddress value to set. + * @return the SqlServerInstanceManagedInstanceLinkAssessmentRequest object itself. + */ + public SqlServerInstanceManagedInstanceLinkAssessmentRequest withSqlServerIpAddress(String sqlServerIpAddress) { + this.sqlServerIpAddress = sqlServerIpAddress; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureManagedInstanceResourceId", this.azureManagedInstanceResourceId); + jsonWriter.writeArrayField("databaseNames", this.databaseNames, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("availabilityGroupName", this.availabilityGroupName); + jsonWriter.writeStringField("distributedAvailabilityGroupName", this.distributedAvailabilityGroupName); + jsonWriter.writeStringField("azureManagedInstanceRole", + this.azureManagedInstanceRole == null ? null : this.azureManagedInstanceRole.toString()); + jsonWriter.writeArrayField("assessmentCategories", this.assessmentCategories, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("sqlServerIpAddress", this.sqlServerIpAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceManagedInstanceLinkAssessmentRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceManagedInstanceLinkAssessmentRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceManagedInstanceLinkAssessmentRequest. + */ + public static SqlServerInstanceManagedInstanceLinkAssessmentRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceManagedInstanceLinkAssessmentRequest deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest + = new SqlServerInstanceManagedInstanceLinkAssessmentRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureManagedInstanceResourceId".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.azureManagedInstanceResourceId + = reader.getString(); + } else if ("databaseNames".equals(fieldName)) { + List databaseNames = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.databaseNames = databaseNames; + } else if ("availabilityGroupName".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.availabilityGroupName + = reader.getString(); + } else if ("distributedAvailabilityGroupName".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.distributedAvailabilityGroupName + = reader.getString(); + } else if ("azureManagedInstanceRole".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.azureManagedInstanceRole + = AzureManagedInstanceRole.fromString(reader.getString()); + } else if ("assessmentCategories".equals(fieldName)) { + List assessmentCategories + = reader.readArray(reader1 -> MiLinkAssessmentCategory.fromString(reader1.getString())); + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.assessmentCategories + = assessmentCategories; + } else if ("sqlServerIpAddress".equals(fieldName)) { + deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest.sqlServerIpAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceManagedInstanceLinkAssessmentRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentResponse.java new file mode 100644 index 000000000000..26be1251df88 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentResponse.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceManagedInstanceLinkAssessmentResponse. + */ +public interface SqlServerInstanceManagedInstanceLinkAssessmentResponse { + /** + * Gets the assessments property: The list of the results for MI Link assessment. + * + * @return the assessments value. + */ + List assessments(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceMigrationReadinessReportResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceMigrationReadinessReportResponse.java new file mode 100644 index 000000000000..dd413d5d655e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceMigrationReadinessReportResponse.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of SqlServerInstanceMigrationReadinessReportResponse. + */ +public interface SqlServerInstanceMigrationReadinessReportResponse { + /** + * Gets the report property: The migration readiness report as a serialized JSON string. When isCompressed is true, + * the value is base64-encoded GZip-compressed and must be decoded and decompressed before parsing. + * + * @return the report value. + */ + String report(); + + /** + * Gets the isCompressed property: Indicates whether the report field contains base64-encoded GZip-compressed JSON. + * + * @return the isCompressed value. + */ + Boolean isCompressed(); + + /** + * Gets the createdTime property: The UTC timestamp in ISO 8601 format indicating when the migration readiness + * report was created. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceMigrationReadinessReportResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java index 55d323b0545e..fd7c0b974ff1 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.annotation.Fluent; import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,6 +13,7 @@ import java.io.IOException; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; +import java.util.List; /** * Properties of SqlServerInstance. @@ -35,6 +35,11 @@ public final class SqlServerInstanceProperties implements JsonSerializable traceFlags; + /* * SQL Server current version. */ @@ -101,10 +131,98 @@ public final class SqlServerInstanceProperties implements JsonSerializable traceFlags() { + return this.traceFlags; } /** - * Set the currentVersion property: SQL Server current version. + * Get the currentVersion property: SQL Server current version. * - * @param currentVersion the currentVersion value to set. - * @return the SqlServerInstanceProperties object itself. + * @return the currentVersion value. */ - public SqlServerInstanceProperties withCurrentVersion(String currentVersion) { - this.currentVersion = currentVersion; - return this; + public String currentVersion() { + return this.currentVersion; } /** @@ -310,145 +441,338 @@ public String tcpDynamicPorts() { } /** - * Set the tcpDynamicPorts property: Dynamic TCP ports used by SQL Server. + * Get the tcpStaticPorts property: Static TCP ports used by SQL Server. + * + * @return the tcpStaticPorts value. + */ + public String tcpStaticPorts() { + return this.tcpStaticPorts; + } + + /** + * Get the productId property: SQL Server product ID. + * + * @return the productId value. + */ + public String productId() { + return this.productId; + } + + /** + * Get the licenseType property: SQL Server license type. + * + * @return the licenseType value. + */ + public ArcSqlServerLicenseType licenseType() { + return this.licenseType; + } + + /** + * Get the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. + * + * @return the azureDefenderStatusLastUpdated value. + */ + public OffsetDateTime azureDefenderStatusLastUpdated() { + return this.azureDefenderStatusLastUpdated; + } + + /** + * Get the azureDefenderStatus property: Status of Azure Defender. + * + * @return the azureDefenderStatus value. + */ + public DefenderStatus azureDefenderStatus() { + return this.azureDefenderStatus; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastInventoryUploadTime property: The time when last successful inventory upload was performed. + * + * @return the lastInventoryUploadTime value. + */ + public OffsetDateTime lastInventoryUploadTime() { + return this.lastInventoryUploadTime; + } + + /** + * Get the lastUsageUploadTime property: The time when last successful usage upload was performed. + * + * @return the lastUsageUploadTime value. + */ + public OffsetDateTime lastUsageUploadTime() { + return this.lastUsageUploadTime; + } + + /** + * Get the hostType property: Type of host for Azure Arc SQL Server. + * + * @return the hostType value. + */ + public HostType hostType() { + return this.hostType; + } + + /** + * Set the hostType property: Type of host for Azure Arc SQL Server. * - * @param tcpDynamicPorts the tcpDynamicPorts value to set. + * @param hostType the hostType value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withTcpDynamicPorts(String tcpDynamicPorts) { - this.tcpDynamicPorts = tcpDynamicPorts; + public SqlServerInstanceProperties withHostType(HostType hostType) { + this.hostType = hostType; return this; } /** - * Get the tcpStaticPorts property: Static TCP ports used by SQL Server. + * Get the alwaysOnRole property: The role of the SQL Server, based on availability. * - * @return the tcpStaticPorts value. + * @return the alwaysOnRole value. */ - public String tcpStaticPorts() { - return this.tcpStaticPorts; + public AlwaysOnRole alwaysOnRole() { + return this.alwaysOnRole; } /** - * Set the tcpStaticPorts property: Static TCP ports used by SQL Server. + * Get the databaseMirroringEndpoint property: Database mirroring endpoint related properties. * - * @param tcpStaticPorts the tcpStaticPorts value to set. + * @return the databaseMirroringEndpoint value. + */ + public DBMEndpoint databaseMirroringEndpoint() { + return this.databaseMirroringEndpoint; + } + + /** + * Set the databaseMirroringEndpoint property: Database mirroring endpoint related properties. + * + * @param databaseMirroringEndpoint the databaseMirroringEndpoint value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withTcpStaticPorts(String tcpStaticPorts) { - this.tcpStaticPorts = tcpStaticPorts; + public SqlServerInstanceProperties withDatabaseMirroringEndpoint(DBMEndpoint databaseMirroringEndpoint) { + this.databaseMirroringEndpoint = databaseMirroringEndpoint; return this; } /** - * Get the productId property: SQL Server product ID. + * Get the failoverCluster property: Failover Cluster Instance properties. * - * @return the productId value. + * @return the failoverCluster value. */ - public String productId() { - return this.productId; + public FailoverCluster failoverCluster() { + return this.failoverCluster; } /** - * Set the productId property: SQL Server product ID. + * Set the failoverCluster property: Failover Cluster Instance properties. * - * @param productId the productId value to set. + * @param failoverCluster the failoverCluster value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withProductId(String productId) { - this.productId = productId; + public SqlServerInstanceProperties withFailoverCluster(FailoverCluster failoverCluster) { + this.failoverCluster = failoverCluster; return this; } /** - * Get the licenseType property: SQL Server license type. + * Get the backupPolicy property: The backup profile for the SQL server. * - * @return the licenseType value. + * @return the backupPolicy value. */ - public ArcSqlServerLicenseType licenseType() { - return this.licenseType; + public BackupPolicy backupPolicy() { + return this.backupPolicy; } /** - * Set the licenseType property: SQL Server license type. + * Set the backupPolicy property: The backup profile for the SQL server. * - * @param licenseType the licenseType value to set. + * @param backupPolicy the backupPolicy value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withLicenseType(ArcSqlServerLicenseType licenseType) { - this.licenseType = licenseType; + public SqlServerInstanceProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; return this; } /** - * Get the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. + * Get the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. * - * @return the azureDefenderStatusLastUpdated value. + * @return the upgradeLockedUntil value. */ - public OffsetDateTime azureDefenderStatusLastUpdated() { - return this.azureDefenderStatusLastUpdated; + public OffsetDateTime upgradeLockedUntil() { + return this.upgradeLockedUntil; } /** - * Set the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. + * Set the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. * - * @param azureDefenderStatusLastUpdated the azureDefenderStatusLastUpdated value to set. + * @param upgradeLockedUntil the upgradeLockedUntil value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties - withAzureDefenderStatusLastUpdated(OffsetDateTime azureDefenderStatusLastUpdated) { - this.azureDefenderStatusLastUpdated = azureDefenderStatusLastUpdated; + public SqlServerInstanceProperties withUpgradeLockedUntil(OffsetDateTime upgradeLockedUntil) { + this.upgradeLockedUntil = upgradeLockedUntil; return this; } /** - * Get the azureDefenderStatus property: Status of Azure Defender. + * Get the monitoring property: The monitoring configuration. * - * @return the azureDefenderStatus value. + * @return the monitoring value. */ - public DefenderStatus azureDefenderStatus() { - return this.azureDefenderStatus; + public Monitoring monitoring() { + return this.monitoring; } /** - * Set the azureDefenderStatus property: Status of Azure Defender. + * Set the monitoring property: The monitoring configuration. * - * @param azureDefenderStatus the azureDefenderStatus value to set. + * @param monitoring the monitoring value to set. * @return the SqlServerInstanceProperties object itself. */ - public SqlServerInstanceProperties withAzureDefenderStatus(DefenderStatus azureDefenderStatus) { - this.azureDefenderStatus = azureDefenderStatus; + public SqlServerInstanceProperties withMonitoring(Monitoring monitoring) { + this.monitoring = monitoring; return this; } /** - * Get the provisioningState property: The provisioningState property. + * Get the migration property: Migration related configuration and status. * - * @return the provisioningState value. + * @return the migration value. */ - public String provisioningState() { - return this.provisioningState; + public Migration migration() { + return this.migration; + } + + /** + * Set the migration property: Migration related configuration and status. + * + * @param migration the migration value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withMigration(Migration migration) { + this.migration = migration; + return this; + } + + /** + * Get the bestPracticesAssessment property: The configuration related to SQL best practices assessment. + * + * @return the bestPracticesAssessment value. + */ + public BestPracticesAssessment bestPracticesAssessment() { + return this.bestPracticesAssessment; + } + + /** + * Set the bestPracticesAssessment property: The configuration related to SQL best practices assessment. + * + * @param bestPracticesAssessment the bestPracticesAssessment value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withBestPracticesAssessment(BestPracticesAssessment bestPracticesAssessment) { + this.bestPracticesAssessment = bestPracticesAssessment; + return this; + } + + /** + * Get the clientConnection property: Client connection related configuration. + * + * @return the clientConnection value. + */ + public ClientConnection clientConnection() { + return this.clientConnection; + } + + /** + * Set the clientConnection property: Client connection related configuration. + * + * @param clientConnection the clientConnection value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withClientConnection(ClientConnection clientConnection) { + this.clientConnection = clientConnection; + return this; + } + + /** + * Get the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Set the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @param serviceType the serviceType value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Get the maxServerMemoryMB property: maximum server memory (MB) value configured for this instance. + * + * @return the maxServerMemoryMB value. + */ + public Long maxServerMemoryMB() { + return this.maxServerMemoryMB; + } + + /** + * Get the isMicrosoftPkiCertTrustConfigured property: Indicates whether Microsoft PKI root-authority certificate + * (trusted by Azure) exists in SQL Server and trusted for Azure database.windows.net domains. + * + * @return the isMicrosoftPkiCertTrustConfigured value. + */ + public Boolean isMicrosoftPkiCertTrustConfigured() { + return this.isMicrosoftPkiCertTrustConfigured; + } + + /** + * Get the isDigiCertPkiCertTrustConfigured property: Indicates whether DigiCert PKI root-authority certificate + * (trusted by Azure) exists in SQL Server and trusted for Azure database.windows.net domains. + * + * @return the isDigiCertPkiCertTrustConfigured value. + */ + public Boolean isDigiCertPkiCertTrustConfigured() { + return this.isDigiCertPkiCertTrustConfigured; } /** - * Validates the instance. + * Get the authentication property: Authentication related configuration for the SQL Server Instance. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the authentication value. */ - public void validate() { - if (containerResourceId() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property containerResourceId in model SqlServerInstanceProperties")); - } - if (status() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property status in model SqlServerInstanceProperties")); - } + public Authentication authentication() { + return this.authentication; } - private static final ClientLogger LOGGER = new ClientLogger(SqlServerInstanceProperties.class); + /** + * Set the authentication property: Authentication related configuration for the SQL Server Instance. + * + * @param authentication the authentication value to set. + * @return the SqlServerInstanceProperties object itself. + */ + public SqlServerInstanceProperties withAuthentication(Authentication authentication) { + this.authentication = authentication; + return this; + } /** * {@inheritDoc} @@ -456,25 +780,26 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("containerResourceId", this.containerResourceId); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); jsonWriter.writeStringField("edition", this.edition == null ? null : this.edition.toString()); - jsonWriter.writeStringField("vCore", this.vCore); - jsonWriter.writeStringField("patchLevel", this.patchLevel); - jsonWriter.writeStringField("collation", this.collation); - jsonWriter.writeStringField("currentVersion", this.currentVersion); + jsonWriter.writeStringField("cores", this.cores); + jsonWriter.writeStringField("discoverySource", + this.discoverySource == null ? null : this.discoverySource.toString()); jsonWriter.writeStringField("instanceName", this.instanceName); - jsonWriter.writeStringField("tcpDynamicPorts", this.tcpDynamicPorts); - jsonWriter.writeStringField("tcpStaticPorts", this.tcpStaticPorts); - jsonWriter.writeStringField("productId", this.productId); - jsonWriter.writeStringField("licenseType", this.licenseType == null ? null : this.licenseType.toString()); - jsonWriter.writeStringField("azureDefenderStatusLastUpdated", - this.azureDefenderStatusLastUpdated == null + jsonWriter.writeStringField("hostType", this.hostType == null ? null : this.hostType.toString()); + jsonWriter.writeJsonField("databaseMirroringEndpoint", this.databaseMirroringEndpoint); + jsonWriter.writeJsonField("failoverCluster", this.failoverCluster); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeStringField("upgradeLockedUntil", + this.upgradeLockedUntil == null ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.azureDefenderStatusLastUpdated)); - jsonWriter.writeStringField("azureDefenderStatus", - this.azureDefenderStatus == null ? null : this.azureDefenderStatus.toString()); + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.upgradeLockedUntil)); + jsonWriter.writeJsonField("monitoring", this.monitoring); + jsonWriter.writeJsonField("migration", this.migration); + jsonWriter.writeJsonField("bestPracticesAssessment", this.bestPracticesAssessment); + jsonWriter.writeJsonField("clientConnection", this.clientConnection); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeJsonField("authentication", this.authentication); return jsonWriter.writeEndObject(); } @@ -484,7 +809,6 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of SqlServerInstanceProperties if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the SqlServerInstanceProperties. */ public static SqlServerInstanceProperties fromJson(JsonReader jsonReader) throws IOException { @@ -494,22 +818,37 @@ public static SqlServerInstanceProperties fromJson(JsonReader jsonReader) throws String fieldName = reader.getFieldName(); reader.nextToken(); - if ("containerResourceId".equals(fieldName)) { - deserializedSqlServerInstanceProperties.containerResourceId = reader.getString(); - } else if ("status".equals(fieldName)) { - deserializedSqlServerInstanceProperties.status = ConnectionStatus.fromString(reader.getString()); - } else if ("version".equals(fieldName)) { + if ("version".equals(fieldName)) { deserializedSqlServerInstanceProperties.version = SqlVersion.fromString(reader.getString()); } else if ("edition".equals(fieldName)) { deserializedSqlServerInstanceProperties.edition = EditionType.fromString(reader.getString()); + } else if ("containerResourceId".equals(fieldName)) { + deserializedSqlServerInstanceProperties.containerResourceId = reader.getString(); + } else if ("vmId".equals(fieldName)) { + deserializedSqlServerInstanceProperties.vmId = reader.getString(); } else if ("createTime".equals(fieldName)) { deserializedSqlServerInstanceProperties.createTime = reader.getString(); } else if ("vCore".equals(fieldName)) { deserializedSqlServerInstanceProperties.vCore = reader.getString(); + } else if ("cores".equals(fieldName)) { + deserializedSqlServerInstanceProperties.cores = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSqlServerInstanceProperties.status = ConnectionStatus.fromString(reader.getString()); + } else if ("discoverySource".equals(fieldName)) { + deserializedSqlServerInstanceProperties.discoverySource + = DiscoverySource.fromString(reader.getString()); } else if ("patchLevel".equals(fieldName)) { deserializedSqlServerInstanceProperties.patchLevel = reader.getString(); } else if ("collation".equals(fieldName)) { deserializedSqlServerInstanceProperties.collation = reader.getString(); + } else if ("dbMasterKeyExists".equals(fieldName)) { + deserializedSqlServerInstanceProperties.dbMasterKeyExists + = reader.getNullable(JsonReader::getBoolean); + } else if ("isHadrEnabled".equals(fieldName)) { + deserializedSqlServerInstanceProperties.isHadrEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("traceFlags".equals(fieldName)) { + List traceFlags = reader.readArray(reader1 -> reader1.getInt()); + deserializedSqlServerInstanceProperties.traceFlags = traceFlags; } else if ("currentVersion".equals(fieldName)) { deserializedSqlServerInstanceProperties.currentVersion = reader.getString(); } else if ("instanceName".equals(fieldName)) { @@ -531,6 +870,46 @@ public static SqlServerInstanceProperties fromJson(JsonReader jsonReader) throws = DefenderStatus.fromString(reader.getString()); } else if ("provisioningState".equals(fieldName)) { deserializedSqlServerInstanceProperties.provisioningState = reader.getString(); + } else if ("lastInventoryUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceProperties.lastInventoryUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastUsageUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceProperties.lastUsageUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("hostType".equals(fieldName)) { + deserializedSqlServerInstanceProperties.hostType = HostType.fromString(reader.getString()); + } else if ("alwaysOnRole".equals(fieldName)) { + deserializedSqlServerInstanceProperties.alwaysOnRole = AlwaysOnRole.fromString(reader.getString()); + } else if ("databaseMirroringEndpoint".equals(fieldName)) { + deserializedSqlServerInstanceProperties.databaseMirroringEndpoint = DBMEndpoint.fromJson(reader); + } else if ("failoverCluster".equals(fieldName)) { + deserializedSqlServerInstanceProperties.failoverCluster = FailoverCluster.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedSqlServerInstanceProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("upgradeLockedUntil".equals(fieldName)) { + deserializedSqlServerInstanceProperties.upgradeLockedUntil = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("monitoring".equals(fieldName)) { + deserializedSqlServerInstanceProperties.monitoring = Monitoring.fromJson(reader); + } else if ("migration".equals(fieldName)) { + deserializedSqlServerInstanceProperties.migration = Migration.fromJson(reader); + } else if ("bestPracticesAssessment".equals(fieldName)) { + deserializedSqlServerInstanceProperties.bestPracticesAssessment + = BestPracticesAssessment.fromJson(reader); + } else if ("clientConnection".equals(fieldName)) { + deserializedSqlServerInstanceProperties.clientConnection = ClientConnection.fromJson(reader); + } else if ("serviceType".equals(fieldName)) { + deserializedSqlServerInstanceProperties.serviceType = ServiceType.fromString(reader.getString()); + } else if ("maxServerMemoryMB".equals(fieldName)) { + deserializedSqlServerInstanceProperties.maxServerMemoryMB = reader.getNullable(JsonReader::getLong); + } else if ("isMicrosoftPkiCertTrustConfigured".equals(fieldName)) { + deserializedSqlServerInstanceProperties.isMicrosoftPkiCertTrustConfigured + = reader.getNullable(JsonReader::getBoolean); + } else if ("isDigiCertPkiCertTrustConfigured".equals(fieldName)) { + deserializedSqlServerInstanceProperties.isDigiCertPkiCertTrustConfigured + = reader.getNullable(JsonReader::getBoolean); + } else if ("authentication".equals(fieldName)) { + deserializedSqlServerInstanceProperties.authentication = Authentication.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunBestPracticesAssessmentResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunBestPracticesAssessmentResponse.java new file mode 100644 index 000000000000..f1a4f34b776c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunBestPracticesAssessmentResponse.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceRunBestPracticesAssessmentResponse. + */ +public interface SqlServerInstanceRunBestPracticesAssessmentResponse { + /** + * Gets the id property: The unique identifier of the job. + * + * @return the id value. + */ + String id(); + + /** + * Gets the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + String instanceName(); + + /** + * Gets the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + JobStatus jobStatus(); + + /** + * Gets the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + String jobException(); + + /** + * Gets the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + BackgroundJob backgroundJob(); + + /** + * Gets the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + List sequencerActions(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceRunBestPracticesAssessmentResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java new file mode 100644 index 000000000000..fda437e36b01 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceRunMigrationAssessmentResponse. + */ +public interface SqlServerInstanceRunMigrationAssessmentResponse { + /** + * Gets the id property: The unique identifier of the job. + * + * @return the id value. + */ + String id(); + + /** + * Gets the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + String instanceName(); + + /** + * Gets the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + JobStatus jobStatus(); + + /** + * Gets the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + String jobException(); + + /** + * Gets the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + BackgroundJob backgroundJob(); + + /** + * Gets the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + List sequencerActions(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner object. + * + * @return the inner object. + */ + SqlServerInstanceRunMigrationAssessmentResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationReadinessAssessmentResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationReadinessAssessmentResponse.java new file mode 100644 index 000000000000..fb3c8b181184 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationReadinessAssessmentResponse.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceRunMigrationReadinessAssessmentResponse. + */ +public interface SqlServerInstanceRunMigrationReadinessAssessmentResponse { + /** + * Gets the id property: The unique identifier of the job. + * + * @return the id value. + */ + String id(); + + /** + * Gets the instanceName property: The name of the SQL Server instance. + * + * @return the instanceName value. + */ + String instanceName(); + + /** + * Gets the jobStatus property: The status of the job. + * + * @return the jobStatus value. + */ + JobStatus jobStatus(); + + /** + * Gets the jobException property: The exception message if the job failed. + * + * @return the jobException value. + */ + String jobException(); + + /** + * Gets the backgroundJob property: The background job details. + * + * @return the backgroundJob value. + */ + BackgroundJob backgroundJob(); + + /** + * Gets the sequencerActions property: The list of sequencer actions. + * + * @return the sequencerActions value. + */ + List sequencerActions(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobRequest.java new file mode 100644 index 000000000000..88f4daa3b514 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobRequest.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request for running a SQL Server Instance target recommendation job. + */ +@Fluent +public final class SqlServerInstanceRunTargetRecommendationJobRequest + implements JsonSerializable { + /* + * Controls whether the SQL Server instance resource is updated with the target recommendation details after the job + * completes. + */ + private ResourceUpdateMode resourceUpdateMode; + + /* + * Specifies whether to include file-level requirements in the target recommendation report. + */ + private Boolean includeFileLevelRequirements; + + /* + * The Azure region used for target SKU pricing and availability (e.g., 'westus', 'eastus2', 'westeurope'). + */ + private String targetLocation; + + /* + * The percentile of performance data points used for aggregation (Range: 1-100). + */ + private Integer percentile; + + /* + * The lookback period in days for performance data used in the target recommendation. + */ + private Integer lookbackPeriodInDays; + + /** + * Creates an instance of SqlServerInstanceRunTargetRecommendationJobRequest class. + */ + public SqlServerInstanceRunTargetRecommendationJobRequest() { + } + + /** + * Get the resourceUpdateMode property: Controls whether the SQL Server instance resource is updated with the target + * recommendation details after the job completes. + * + * @return the resourceUpdateMode value. + */ + public ResourceUpdateMode resourceUpdateMode() { + return this.resourceUpdateMode; + } + + /** + * Set the resourceUpdateMode property: Controls whether the SQL Server instance resource is updated with the target + * recommendation details after the job completes. + * + * @param resourceUpdateMode the resourceUpdateMode value to set. + * @return the SqlServerInstanceRunTargetRecommendationJobRequest object itself. + */ + public SqlServerInstanceRunTargetRecommendationJobRequest + withResourceUpdateMode(ResourceUpdateMode resourceUpdateMode) { + this.resourceUpdateMode = resourceUpdateMode; + return this; + } + + /** + * Get the includeFileLevelRequirements property: Specifies whether to include file-level requirements in the target + * recommendation report. + * + * @return the includeFileLevelRequirements value. + */ + public Boolean includeFileLevelRequirements() { + return this.includeFileLevelRequirements; + } + + /** + * Set the includeFileLevelRequirements property: Specifies whether to include file-level requirements in the target + * recommendation report. + * + * @param includeFileLevelRequirements the includeFileLevelRequirements value to set. + * @return the SqlServerInstanceRunTargetRecommendationJobRequest object itself. + */ + public SqlServerInstanceRunTargetRecommendationJobRequest + withIncludeFileLevelRequirements(Boolean includeFileLevelRequirements) { + this.includeFileLevelRequirements = includeFileLevelRequirements; + return this; + } + + /** + * Get the targetLocation property: The Azure region used for target SKU pricing and availability (e.g., 'westus', + * 'eastus2', 'westeurope'). + * + * @return the targetLocation value. + */ + public String targetLocation() { + return this.targetLocation; + } + + /** + * Set the targetLocation property: The Azure region used for target SKU pricing and availability (e.g., 'westus', + * 'eastus2', 'westeurope'). + * + * @param targetLocation the targetLocation value to set. + * @return the SqlServerInstanceRunTargetRecommendationJobRequest object itself. + */ + public SqlServerInstanceRunTargetRecommendationJobRequest withTargetLocation(String targetLocation) { + this.targetLocation = targetLocation; + return this; + } + + /** + * Get the percentile property: The percentile of performance data points used for aggregation (Range: 1-100). + * + * @return the percentile value. + */ + public Integer percentile() { + return this.percentile; + } + + /** + * Set the percentile property: The percentile of performance data points used for aggregation (Range: 1-100). + * + * @param percentile the percentile value to set. + * @return the SqlServerInstanceRunTargetRecommendationJobRequest object itself. + */ + public SqlServerInstanceRunTargetRecommendationJobRequest withPercentile(Integer percentile) { + this.percentile = percentile; + return this; + } + + /** + * Get the lookbackPeriodInDays property: The lookback period in days for performance data used in the target + * recommendation. + * + * @return the lookbackPeriodInDays value. + */ + public Integer lookbackPeriodInDays() { + return this.lookbackPeriodInDays; + } + + /** + * Set the lookbackPeriodInDays property: The lookback period in days for performance data used in the target + * recommendation. + * + * @param lookbackPeriodInDays the lookbackPeriodInDays value to set. + * @return the SqlServerInstanceRunTargetRecommendationJobRequest object itself. + */ + public SqlServerInstanceRunTargetRecommendationJobRequest withLookbackPeriodInDays(Integer lookbackPeriodInDays) { + this.lookbackPeriodInDays = lookbackPeriodInDays; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceUpdateMode", + this.resourceUpdateMode == null ? null : this.resourceUpdateMode.toString()); + jsonWriter.writeBooleanField("includeFileLevelRequirements", this.includeFileLevelRequirements); + jsonWriter.writeStringField("targetLocation", this.targetLocation); + jsonWriter.writeNumberField("percentile", this.percentile); + jsonWriter.writeNumberField("lookbackPeriodInDays", this.lookbackPeriodInDays); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceRunTargetRecommendationJobRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceRunTargetRecommendationJobRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceRunTargetRecommendationJobRequest. + */ + public static SqlServerInstanceRunTargetRecommendationJobRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceRunTargetRecommendationJobRequest deserializedSqlServerInstanceRunTargetRecommendationJobRequest + = new SqlServerInstanceRunTargetRecommendationJobRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceUpdateMode".equals(fieldName)) { + deserializedSqlServerInstanceRunTargetRecommendationJobRequest.resourceUpdateMode + = ResourceUpdateMode.fromString(reader.getString()); + } else if ("includeFileLevelRequirements".equals(fieldName)) { + deserializedSqlServerInstanceRunTargetRecommendationJobRequest.includeFileLevelRequirements + = reader.getNullable(JsonReader::getBoolean); + } else if ("targetLocation".equals(fieldName)) { + deserializedSqlServerInstanceRunTargetRecommendationJobRequest.targetLocation = reader.getString(); + } else if ("percentile".equals(fieldName)) { + deserializedSqlServerInstanceRunTargetRecommendationJobRequest.percentile + = reader.getNullable(JsonReader::getInt); + } else if ("lookbackPeriodInDays".equals(fieldName)) { + deserializedSqlServerInstanceRunTargetRecommendationJobRequest.lookbackPeriodInDays + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceRunTargetRecommendationJobRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobResponse.java new file mode 100644 index 000000000000..06c816cd6757 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobResponse.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner; + +/** + * An immutable client-side representation of SqlServerInstanceRunTargetRecommendationJobResponse. + */ +public interface SqlServerInstanceRunTargetRecommendationJobResponse { + /** + * Gets the jobStatus property: Represents the current status of the target recommendation job. + * + * @return the jobStatus value. + */ + JobStatus jobStatus(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceRunTargetRecommendationJobResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReport.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReport.java new file mode 100644 index 000000000000..e581a672f819 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReport.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Represents a target recommendation report for a SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceTargetRecommendationReport + implements JsonSerializable { + /* + * The identifier of the target recommendation report. + */ + private String reportId; + + /* + * The UTC timestamp in ISO 8601 format indicating when the target recommendation report was generated. + */ + private OffsetDateTime createdTime; + + /* + * Collection of sections included in the report. + */ + private List sections; + + /** + * Creates an instance of SqlServerInstanceTargetRecommendationReport class. + */ + private SqlServerInstanceTargetRecommendationReport() { + } + + /** + * Get the reportId property: The identifier of the target recommendation report. + * + * @return the reportId value. + */ + public String reportId() { + return this.reportId; + } + + /** + * Get the createdTime property: The UTC timestamp in ISO 8601 format indicating when the target recommendation + * report was generated. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the sections property: Collection of sections included in the report. + * + * @return the sections value. + */ + public List sections() { + return this.sections; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTargetRecommendationReport from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTargetRecommendationReport if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceTargetRecommendationReport. + */ + public static SqlServerInstanceTargetRecommendationReport fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTargetRecommendationReport deserializedSqlServerInstanceTargetRecommendationReport + = new SqlServerInstanceTargetRecommendationReport(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reportId".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReport.reportId = reader.getString(); + } else if ("createdTime".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReport.createdTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("sections".equals(fieldName)) { + List sections = reader + .readArray(reader1 -> SqlServerInstanceTargetRecommendationReportSection.fromJson(reader1)); + deserializedSqlServerInstanceTargetRecommendationReport.sections = sections; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTargetRecommendationReport; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSection.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSection.java new file mode 100644 index 000000000000..411246a69ae3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSection.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents a section within a target recommendation report. + */ +@Immutable +public final class SqlServerInstanceTargetRecommendationReportSection + implements JsonSerializable { + /* + * Serialized JSON representation of the section data. If isCompressed is true, the value contains base64-encoded + * GZip-compressed JSON. + */ + private String data; + + /* + * The type of this section. Requirements sections contain source server performance metrics, while recommendation + * sections contain suggested Azure target SKUs. + */ + private SqlServerInstanceTargetRecommendationReportSectionType type; + + /* + * The name of the database to which this section applies. An empty string indicates that the section contains + * instance-level data rather than database-level data. + */ + private String databaseName; + + /* + * Indicates whether the data field contains base64-encoded GZip-compressed JSON. + */ + private Boolean isCompressed; + + /** + * Creates an instance of SqlServerInstanceTargetRecommendationReportSection class. + */ + private SqlServerInstanceTargetRecommendationReportSection() { + } + + /** + * Get the data property: Serialized JSON representation of the section data. If isCompressed is true, the value + * contains base64-encoded GZip-compressed JSON. + * + * @return the data value. + */ + public String data() { + return this.data; + } + + /** + * Get the type property: The type of this section. Requirements sections contain source server performance metrics, + * while recommendation sections contain suggested Azure target SKUs. + * + * @return the type value. + */ + public SqlServerInstanceTargetRecommendationReportSectionType type() { + return this.type; + } + + /** + * Get the databaseName property: The name of the database to which this section applies. An empty string indicates + * that the section contains instance-level data rather than database-level data. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the isCompressed property: Indicates whether the data field contains base64-encoded GZip-compressed JSON. + * + * @return the isCompressed value. + */ + public Boolean isCompressed() { + return this.isCompressed; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTargetRecommendationReportSection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTargetRecommendationReportSection if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceTargetRecommendationReportSection. + */ + public static SqlServerInstanceTargetRecommendationReportSection fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTargetRecommendationReportSection deserializedSqlServerInstanceTargetRecommendationReportSection + = new SqlServerInstanceTargetRecommendationReportSection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportSection.data = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportSection.type + = SqlServerInstanceTargetRecommendationReportSectionType.fromString(reader.getString()); + } else if ("databaseName".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportSection.databaseName = reader.getString(); + } else if ("isCompressed".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportSection.isCompressed + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTargetRecommendationReportSection; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSectionType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSectionType.java new file mode 100644 index 000000000000..8801319e7f5f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSectionType.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Filters the report to a specific section type. If not specified, all section types are returned. Section types are + * grouped into two categories: requirements sections contain performance and resource metrics collected from the source + * SQL Server, while recommendation sections contain suggested Azure target SKUs derived from those requirements. + */ +public final class SqlServerInstanceTargetRecommendationReportSectionType + extends ExpandableStringEnum { + /** + * Aggregated performance and resource requirements for the entire SQL Server instance, including CPU, memory, IOPS, + * throughput, and storage metrics collected from the source server. + */ + public static final SqlServerInstanceTargetRecommendationReportSectionType REQUIREMENTS_PER_INSTANCE + = fromString("RequirementsPerInstance"); + + /** + * Performance and resource requirements broken down per database, including CPU, memory, IOPS, throughput, and + * storage metrics collected from the source server for each individual database. + */ + public static final SqlServerInstanceTargetRecommendationReportSectionType REQUIREMENTS_PER_DATABASE + = fromString("RequirementsPerDatabase"); + + /** + * File-level performance requirements per database, including IOPS and throughput metrics for individual data and + * log files. Only available when includeFileLevelRequirements is set to true in the RunTargetRecommendationJob + * request. + */ + public static final SqlServerInstanceTargetRecommendationReportSectionType FILE_REQUIREMENTS_PER_DATABASE + = fromString("FileRequirementsPerDatabase"); + + /** + * Recommended Azure SQL Virtual Machine SKU for the entire SQL Server instance, including VM size, compute, + * storage, and estimated monthly cost derived from the collected requirements. + */ + public static final SqlServerInstanceTargetRecommendationReportSectionType SQL_VM_TARGET_RECOMMENDATION_PER_INSTANCE + = fromString("SqlVmTargetRecommendationPerInstance"); + + /** + * Recommended Azure SQL Managed Instance SKU for the entire SQL Server instance, including service tier, compute, + * storage, and estimated monthly cost derived from the collected requirements. + */ + public static final SqlServerInstanceTargetRecommendationReportSectionType SQL_MI_TARGET_RECOMMENDATION_PER_INSTANCE + = fromString("SqlMiTargetRecommendationPerInstance"); + + /** + * Recommended Azure SQL Database SKU per database, including service tier, compute, storage, and estimated monthly + * cost derived from the collected requirements for each individual database. + */ + public static final SqlServerInstanceTargetRecommendationReportSectionType SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE + = fromString("SqlDbTargetRecommendationPerDatabase"); + + /** + * Creates a new instance of SqlServerInstanceTargetRecommendationReportSectionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SqlServerInstanceTargetRecommendationReportSectionType() { + } + + /** + * Creates or finds a SqlServerInstanceTargetRecommendationReportSectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlServerInstanceTargetRecommendationReportSectionType. + */ + public static SqlServerInstanceTargetRecommendationReportSectionType fromString(String name) { + return fromString(name, SqlServerInstanceTargetRecommendationReportSectionType.class); + } + + /** + * Gets known SqlServerInstanceTargetRecommendationReportSectionType values. + * + * @return known SqlServerInstanceTargetRecommendationReportSectionType values. + */ + public static Collection values() { + return values(SqlServerInstanceTargetRecommendationReportSectionType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsRequest.java new file mode 100644 index 000000000000..93ea8be2cb29 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsRequest.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The request for retrieving SQL Server Instance target recommendation reports. + */ +@Fluent +public final class SqlServerInstanceTargetRecommendationReportsRequest + implements JsonSerializable { + /* + * Zero-based offset indicating where to continue reading reports in the overall list of reports. Defaults to 0 if + * not provided. This value must be used together with the corresponding sectionOffset to resume pagination. The + * reportOffset advances only after all sections of the current report have been retrieved. To retrieve subsequent + * pages, use the nextReportOffset and nextSectionOffset values from the previous response. + */ + private Integer reportOffset; + + /* + * Zero-based offset indicating where to continue reading sections within the current report. Defaults to 0 if not + * provided. This value must be used together with the corresponding reportOffset to resume pagination. To retrieve + * subsequent pages, use the nextReportOffset and nextSectionOffset values from the previous response. + */ + private Integer sectionOffset; + + /* + * Filters the report to a specific section type. If not specified, all section types are returned. Section types + * are grouped into two categories: requirements sections contain performance and resource metrics collected from + * the source SQL Server, while recommendation sections contain suggested Azure target SKUs derived from those + * requirements. + */ + private SqlServerInstanceTargetRecommendationReportSectionType sectionType; + + /* + * The list of database names to filter the report sections by. If not specified, sections for all databases are + * returned. + */ + private List databaseNames; + + /** + * Creates an instance of SqlServerInstanceTargetRecommendationReportsRequest class. + */ + public SqlServerInstanceTargetRecommendationReportsRequest() { + } + + /** + * Get the reportOffset property: Zero-based offset indicating where to continue reading reports in the overall list + * of reports. Defaults to 0 if not provided. This value must be used together with the corresponding sectionOffset + * to resume pagination. The reportOffset advances only after all sections of the current report have been + * retrieved. To retrieve subsequent pages, use the nextReportOffset and nextSectionOffset values from the previous + * response. + * + * @return the reportOffset value. + */ + public Integer reportOffset() { + return this.reportOffset; + } + + /** + * Set the reportOffset property: Zero-based offset indicating where to continue reading reports in the overall list + * of reports. Defaults to 0 if not provided. This value must be used together with the corresponding sectionOffset + * to resume pagination. The reportOffset advances only after all sections of the current report have been + * retrieved. To retrieve subsequent pages, use the nextReportOffset and nextSectionOffset values from the previous + * response. + * + * @param reportOffset the reportOffset value to set. + * @return the SqlServerInstanceTargetRecommendationReportsRequest object itself. + */ + public SqlServerInstanceTargetRecommendationReportsRequest withReportOffset(Integer reportOffset) { + this.reportOffset = reportOffset; + return this; + } + + /** + * Get the sectionOffset property: Zero-based offset indicating where to continue reading sections within the + * current report. Defaults to 0 if not provided. This value must be used together with the corresponding + * reportOffset to resume pagination. To retrieve subsequent pages, use the nextReportOffset and nextSectionOffset + * values from the previous response. + * + * @return the sectionOffset value. + */ + public Integer sectionOffset() { + return this.sectionOffset; + } + + /** + * Set the sectionOffset property: Zero-based offset indicating where to continue reading sections within the + * current report. Defaults to 0 if not provided. This value must be used together with the corresponding + * reportOffset to resume pagination. To retrieve subsequent pages, use the nextReportOffset and nextSectionOffset + * values from the previous response. + * + * @param sectionOffset the sectionOffset value to set. + * @return the SqlServerInstanceTargetRecommendationReportsRequest object itself. + */ + public SqlServerInstanceTargetRecommendationReportsRequest withSectionOffset(Integer sectionOffset) { + this.sectionOffset = sectionOffset; + return this; + } + + /** + * Get the sectionType property: Filters the report to a specific section type. If not specified, all section types + * are returned. Section types are grouped into two categories: requirements sections contain performance and + * resource metrics collected from the source SQL Server, while recommendation sections contain suggested Azure + * target SKUs derived from those requirements. + * + * @return the sectionType value. + */ + public SqlServerInstanceTargetRecommendationReportSectionType sectionType() { + return this.sectionType; + } + + /** + * Set the sectionType property: Filters the report to a specific section type. If not specified, all section types + * are returned. Section types are grouped into two categories: requirements sections contain performance and + * resource metrics collected from the source SQL Server, while recommendation sections contain suggested Azure + * target SKUs derived from those requirements. + * + * @param sectionType the sectionType value to set. + * @return the SqlServerInstanceTargetRecommendationReportsRequest object itself. + */ + public SqlServerInstanceTargetRecommendationReportsRequest + withSectionType(SqlServerInstanceTargetRecommendationReportSectionType sectionType) { + this.sectionType = sectionType; + return this; + } + + /** + * Get the databaseNames property: The list of database names to filter the report sections by. If not specified, + * sections for all databases are returned. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.databaseNames; + } + + /** + * Set the databaseNames property: The list of database names to filter the report sections by. If not specified, + * sections for all databases are returned. + * + * @param databaseNames the databaseNames value to set. + * @return the SqlServerInstanceTargetRecommendationReportsRequest object itself. + */ + public SqlServerInstanceTargetRecommendationReportsRequest withDatabaseNames(List databaseNames) { + this.databaseNames = databaseNames; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("reportOffset", this.reportOffset); + jsonWriter.writeNumberField("sectionOffset", this.sectionOffset); + jsonWriter.writeStringField("sectionType", this.sectionType == null ? null : this.sectionType.toString()); + jsonWriter.writeArrayField("databaseNames", this.databaseNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTargetRecommendationReportsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTargetRecommendationReportsRequest if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceTargetRecommendationReportsRequest. + */ + public static SqlServerInstanceTargetRecommendationReportsRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTargetRecommendationReportsRequest deserializedSqlServerInstanceTargetRecommendationReportsRequest + = new SqlServerInstanceTargetRecommendationReportsRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reportOffset".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsRequest.reportOffset + = reader.getNullable(JsonReader::getInt); + } else if ("sectionOffset".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsRequest.sectionOffset + = reader.getNullable(JsonReader::getInt); + } else if ("sectionType".equals(fieldName)) { + deserializedSqlServerInstanceTargetRecommendationReportsRequest.sectionType + = SqlServerInstanceTargetRecommendationReportSectionType.fromString(reader.getString()); + } else if ("databaseNames".equals(fieldName)) { + List databaseNames = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlServerInstanceTargetRecommendationReportsRequest.databaseNames = databaseNames; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTargetRecommendationReportsRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsResponse.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsResponse.java new file mode 100644 index 000000000000..1da6b87366a6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsResponse.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of SqlServerInstanceTargetRecommendationReportsResponse. + */ +public interface SqlServerInstanceTargetRecommendationReportsResponse { + /** + * Gets the jobStatus property: Represents the status of the latest target recommendation job. Report records are + * returned only when the job status is Succeeded. + * + * @return the jobStatus value. + */ + JobStatus jobStatus(); + + /** + * Gets the reports property: A collection of target recommendation reports. Returned only when the job status is + * Succeeded. + * + * @return the reports value. + */ + List reports(); + + /** + * Gets the totalReportCount property: The total number of target recommendation reports available for retrieval. + * Currently, only the latest report is returned, so this value is always 1. + * + * @return the totalReportCount value. + */ + Integer totalReportCount(); + + /** + * Gets the nextReportOffset property: The report offset to use in the next request along with nextSectionOffset to + * continue retrieving data. This value remains the same until all sections of the current report have been + * retrieved. Present only when there is more data to retrieve. When both nextReportOffset and nextSectionOffset are + * absent, all data has been returned. + * + * @return the nextReportOffset value. + */ + Integer nextReportOffset(); + + /** + * Gets the nextSectionOffset property: The section offset to use in the next request along with nextReportOffset to + * continue retrieving sections of the current report. Present only when there is more data to retrieve. When both + * nextReportOffset and nextSectionOffset are absent, all data has been returned. + * + * @return the nextSectionOffset value. + */ + Integer nextSectionOffset(); + + /** + * Gets the inner + * com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner + * object. + * + * @return the inner object. + */ + SqlServerInstanceTargetRecommendationReportsResponseInner innerModel(); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.java new file mode 100644 index 000000000000..a0bade2e5ba3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The telemetry column for the SQL Server instance. + */ +@Immutable +public final class SqlServerInstanceTelemetryColumn implements JsonSerializable { + /* + * The name of the telemetry column. + */ + private String name; + + /* + * The type of the telemetry column. + */ + private SqlServerInstanceTelemetryColumnType type; + + /** + * Creates an instance of SqlServerInstanceTelemetryColumn class. + */ + private SqlServerInstanceTelemetryColumn() { + } + + /** + * Get the name property: The name of the telemetry column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the telemetry column. + * + * @return the type value. + */ + public SqlServerInstanceTelemetryColumnType type() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTelemetryColumn from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTelemetryColumn if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceTelemetryColumn. + */ + public static SqlServerInstanceTelemetryColumn fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTelemetryColumn deserializedSqlServerInstanceTelemetryColumn + = new SqlServerInstanceTelemetryColumn(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryColumn.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryColumn.type + = SqlServerInstanceTelemetryColumnType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTelemetryColumn; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java new file mode 100644 index 000000000000..11704c87fa57 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the telemetry column. + */ +public final class SqlServerInstanceTelemetryColumnType + extends ExpandableStringEnum { + /** + * bool. + */ + public static final SqlServerInstanceTelemetryColumnType BOOL = fromString("bool"); + + /** + * datetime. + */ + public static final SqlServerInstanceTelemetryColumnType DATETIME = fromString("datetime"); + + /** + * int. + */ + public static final SqlServerInstanceTelemetryColumnType INT = fromString("int"); + + /** + * long. + */ + public static final SqlServerInstanceTelemetryColumnType LONG = fromString("long"); + + /** + * double. + */ + public static final SqlServerInstanceTelemetryColumnType DOUBLE = fromString("double"); + + /** + * string. + */ + public static final SqlServerInstanceTelemetryColumnType STRING = fromString("string"); + + /** + * guid. + */ + public static final SqlServerInstanceTelemetryColumnType GUID = fromString("guid"); + + /** + * timespan. + */ + public static final SqlServerInstanceTelemetryColumnType TIMESPAN = fromString("timespan"); + + /** + * Creates a new instance of SqlServerInstanceTelemetryColumnType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SqlServerInstanceTelemetryColumnType() { + } + + /** + * Creates or finds a SqlServerInstanceTelemetryColumnType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlServerInstanceTelemetryColumnType. + */ + public static SqlServerInstanceTelemetryColumnType fromString(String name) { + return fromString(name, SqlServerInstanceTelemetryColumnType.class); + } + + /** + * Gets known SqlServerInstanceTelemetryColumnType values. + * + * @return known SqlServerInstanceTelemetryColumnType values. + */ + public static Collection values() { + return values(SqlServerInstanceTelemetryColumnType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java new file mode 100644 index 000000000000..05cc69b2a66e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The Arc SQL Server instance telemetry retrieval request. + */ +@Fluent +public final class SqlServerInstanceTelemetryRequest implements JsonSerializable { + /* + * The name of the telemetry dataset to retrieve. + */ + private String datasetName; + + /* + * The start time for the time range to fetch telemetry for. If not specified, the current time minus 1 hour is + * used. + */ + private OffsetDateTime startTime; + + /* + * The end time for the time range to fetch telemetry for. If not specified, the current time is used. + */ + private OffsetDateTime endTime; + + /* + * The time granularity to fetch telemetry for. This is an ISO8601 duration. Examples: PT15M, PT1H, P1D + */ + private Duration interval; + + /* + * The aggregation type to use for the numerical columns in the dataset. + */ + private AggregationType aggregationType; + + /* + * The list of database names to return telemetry for. If not specified, telemetry for all databases will be + * aggregated and returned. + */ + private List databaseNames; + + /** + * Creates an instance of SqlServerInstanceTelemetryRequest class. + */ + public SqlServerInstanceTelemetryRequest() { + } + + /** + * Get the datasetName property: The name of the telemetry dataset to retrieve. + * + * @return the datasetName value. + */ + public String datasetName() { + return this.datasetName; + } + + /** + * Set the datasetName property: The name of the telemetry dataset to retrieve. + * + * @param datasetName the datasetName value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withDatasetName(String datasetName) { + this.datasetName = datasetName; + return this; + } + + /** + * Get the startTime property: The start time for the time range to fetch telemetry for. If not specified, the + * current time minus 1 hour is used. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time for the time range to fetch telemetry for. If not specified, the + * current time minus 1 hour is used. + * + * @param startTime the startTime value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time for the time range to fetch telemetry for. If not specified, the current + * time is used. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time for the time range to fetch telemetry for. If not specified, the current + * time is used. + * + * @param endTime the endTime value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the interval property: The time granularity to fetch telemetry for. This is an ISO8601 duration. Examples: + * PT15M, PT1H, P1D. + * + * @return the interval value. + */ + public Duration interval() { + return this.interval; + } + + /** + * Set the interval property: The time granularity to fetch telemetry for. This is an ISO8601 duration. Examples: + * PT15M, PT1H, P1D. + * + * @param interval the interval value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withInterval(Duration interval) { + this.interval = interval; + return this; + } + + /** + * Get the aggregationType property: The aggregation type to use for the numerical columns in the dataset. + * + * @return the aggregationType value. + */ + public AggregationType aggregationType() { + return this.aggregationType; + } + + /** + * Set the aggregationType property: The aggregation type to use for the numerical columns in the dataset. + * + * @param aggregationType the aggregationType value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withAggregationType(AggregationType aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get the databaseNames property: The list of database names to return telemetry for. If not specified, telemetry + * for all databases will be aggregated and returned. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.databaseNames; + } + + /** + * Set the databaseNames property: The list of database names to return telemetry for. If not specified, telemetry + * for all databases will be aggregated and returned. + * + * @param databaseNames the databaseNames value to set. + * @return the SqlServerInstanceTelemetryRequest object itself. + */ + public SqlServerInstanceTelemetryRequest withDatabaseNames(List databaseNames) { + this.databaseNames = databaseNames; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("datasetName", this.datasetName); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeStringField("interval", CoreUtils.durationToStringWithDays(this.interval)); + jsonWriter.writeStringField("aggregationType", + this.aggregationType == null ? null : this.aggregationType.toString()); + jsonWriter.writeArrayField("databaseNames", this.databaseNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceTelemetryRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceTelemetryRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerInstanceTelemetryRequest. + */ + public static SqlServerInstanceTelemetryRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceTelemetryRequest deserializedSqlServerInstanceTelemetryRequest + = new SqlServerInstanceTelemetryRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("datasetName".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.datasetName = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("interval".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.interval + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("aggregationType".equals(fieldName)) { + deserializedSqlServerInstanceTelemetryRequest.aggregationType + = AggregationType.fromString(reader.getString()); + } else if ("databaseNames".equals(fieldName)) { + List databaseNames = reader.readArray(reader1 -> reader1.getString()); + deserializedSqlServerInstanceTelemetryRequest.databaseNames = databaseNames; + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceTelemetryRequest; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java index 5a62fbacd79c..03289ce8b295 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -22,6 +22,11 @@ public final class SqlServerInstanceUpdate implements JsonSerializable tags; + /* + * null + */ + private SqlServerInstanceUpdateProperties properties; + /** * Creates an instance of SqlServerInstanceUpdate class. */ @@ -49,11 +54,23 @@ public SqlServerInstanceUpdate withTags(Map tags) { } /** - * Validates the instance. + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlServerInstanceUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @param properties the properties value to set. + * @return the SqlServerInstanceUpdate object itself. */ - public void validate() { + public SqlServerInstanceUpdate withProperties(SqlServerInstanceUpdateProperties properties) { + this.properties = properties; + return this; } /** @@ -63,6 +80,7 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); return jsonWriter.writeEndObject(); } @@ -84,6 +102,8 @@ public static SqlServerInstanceUpdate fromJson(JsonReader jsonReader) throws IOE if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedSqlServerInstanceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerInstanceUpdate.properties = SqlServerInstanceUpdateProperties.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java new file mode 100644 index 000000000000..3e466aff2600 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java @@ -0,0 +1,971 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Properties of update SqlServerInstance. + */ +@Fluent +public final class SqlServerInstanceUpdateProperties implements JsonSerializable { + /* + * SQL Server version. + */ + private SqlVersion version; + + /* + * SQL Server edition. + */ + private EditionType edition; + + /* + * ARM Resource id of the container resource (Azure Arc for Servers). + */ + private String containerResourceId; + + /* + * The unique ID of the hybrid machine that this resource belongs to. + */ + private String vmId; + + /* + * The time when the resource was created. + */ + private String createTime; + + /* + * The number of logical processors used by the SQL Server instance. + */ + private String vCore; + + /* + * The number of total cores of the Operating System Environment (OSE) hosting the SQL Server instance. + */ + private String cores; + + /* + * The cloud connectivity status. + */ + private ConnectionStatus status; + + /* + * Indicates the discovery agent or client for this instance. Default is Azure Arc. + */ + private DiscoverySource discoverySource; + + /* + * SQL Server update level. + */ + private String patchLevel; + + /* + * SQL Server collation. + */ + private String collation; + + /* + * Indicates whether database master key exists in SQL Server. + */ + private Boolean dbMasterKeyExists; + + /* + * Indicates whether always On availability groups is enabled in SQL Server. + */ + private Boolean isHadrEnabled; + + /* + * An array of integers, where each value represents the enabled trace flags in SQL Server. + */ + private List traceFlags; + + /* + * SQL Server current version. + */ + private String currentVersion; + + /* + * SQL Server instance name. + */ + private String instanceName; + + /* + * Dynamic TCP ports used by SQL Server. + */ + private String tcpDynamicPorts; + + /* + * Static TCP ports used by SQL Server. + */ + private String tcpStaticPorts; + + /* + * SQL Server product ID. + */ + private String productId; + + /* + * SQL Server license type. + */ + private ArcSqlServerLicenseType licenseType; + + /* + * Timestamp of last Azure Defender status update. + */ + private OffsetDateTime azureDefenderStatusLastUpdated; + + /* + * Status of Azure Defender. + */ + private DefenderStatus azureDefenderStatus; + + /* + * The provisioning state of the Arc-enabled SQL Server resource. + */ + private String provisioningState; + + /* + * The time when last successful inventory upload was performed. + */ + private OffsetDateTime lastInventoryUploadTime; + + /* + * The time when last successful usage upload was performed. + */ + private OffsetDateTime lastUsageUploadTime; + + /* + * Type of host for Azure Arc SQL Server + */ + private HostType hostType; + + /* + * The role of the SQL Server, based on availability. + */ + private AlwaysOnRole alwaysOnRole; + + /* + * Failover Cluster Instance properties. + */ + private FailoverCluster failoverCluster; + + /* + * The backup profile for the SQL server. + */ + private BackupPolicy backupPolicy; + + /* + * Upgrade Action for this resource is locked until it expires. The Expiration time indicated by this value. It is + * not locked when it is empty. + */ + private OffsetDateTime upgradeLockedUntil; + + /* + * The monitoring configuration. + */ + private Monitoring monitoring; + + /* + * Migration related configuration. + */ + private Migration migration; + + /* + * The configuration related to SQL best practices assessment. + */ + private BestPracticesAssessment bestPracticesAssessment; + + /* + * Client connection related configuration. + */ + private ClientConnection clientConnection; + + /* + * Indicates if the resource represents a SQL Server engine or a SQL Server component service installed on the host. + */ + private ServiceType serviceType; + + /* + * Authentication related configuration for the SQL Server Instance. + */ + private Authentication authentication; + + /* + * Database mirroring endpoint related properties. + */ + private DBMEndpoint databaseMirroringEndpoint; + + /* + * Indicates whether Microsoft PKI root-authority certificate (trusted by Azure) exists in SQL Server and trusted + * for Azure database.windows.net domains. + */ + private Boolean isMicrosoftPkiCertTrustConfigured; + + /* + * Indicates whether DigiCert PKI root-authority certificate (trusted by Azure) exists in SQL Server and trusted for + * Azure database.windows.net domains. + */ + private Boolean isDigiCertPkiCertTrustConfigured; + + /* + * maximum server memory (MB) value configured for this instance. + */ + private Long maxServerMemoryMB; + + /** + * Creates an instance of SqlServerInstanceUpdateProperties class. + */ + public SqlServerInstanceUpdateProperties() { + } + + /** + * Get the version property: SQL Server version. + * + * @return the version value. + */ + public SqlVersion version() { + return this.version; + } + + /** + * Set the version property: SQL Server version. + * + * @param version the version value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withVersion(SqlVersion version) { + this.version = version; + return this; + } + + /** + * Get the edition property: SQL Server edition. + * + * @return the edition value. + */ + public EditionType edition() { + return this.edition; + } + + /** + * Set the edition property: SQL Server edition. + * + * @param edition the edition value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withEdition(EditionType edition) { + this.edition = edition; + return this; + } + + /** + * Get the containerResourceId property: ARM Resource id of the container resource (Azure Arc for Servers). + * + * @return the containerResourceId value. + */ + public String containerResourceId() { + return this.containerResourceId; + } + + /** + * Get the vmId property: The unique ID of the hybrid machine that this resource belongs to. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the createTime property: The time when the resource was created. + * + * @return the createTime value. + */ + public String createTime() { + return this.createTime; + } + + /** + * Get the vCore property: The number of logical processors used by the SQL Server instance. + * + * @return the vCore value. + */ + public String vCore() { + return this.vCore; + } + + /** + * Get the cores property: The number of total cores of the Operating System Environment (OSE) hosting the SQL + * Server instance. + * + * @return the cores value. + */ + public String cores() { + return this.cores; + } + + /** + * Set the cores property: The number of total cores of the Operating System Environment (OSE) hosting the SQL + * Server instance. + * + * @param cores the cores value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withCores(String cores) { + this.cores = cores; + return this; + } + + /** + * Get the status property: The cloud connectivity status. + * + * @return the status value. + */ + public ConnectionStatus status() { + return this.status; + } + + /** + * Get the discoverySource property: Indicates the discovery agent or client for this instance. Default is Azure + * Arc. + * + * @return the discoverySource value. + */ + public DiscoverySource discoverySource() { + return this.discoverySource; + } + + /** + * Set the discoverySource property: Indicates the discovery agent or client for this instance. Default is Azure + * Arc. + * + * @param discoverySource the discoverySource value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withDiscoverySource(DiscoverySource discoverySource) { + this.discoverySource = discoverySource; + return this; + } + + /** + * Get the patchLevel property: SQL Server update level. + * + * @return the patchLevel value. + */ + public String patchLevel() { + return this.patchLevel; + } + + /** + * Get the collation property: SQL Server collation. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Get the dbMasterKeyExists property: Indicates whether database master key exists in SQL Server. + * + * @return the dbMasterKeyExists value. + */ + public Boolean dbMasterKeyExists() { + return this.dbMasterKeyExists; + } + + /** + * Get the isHadrEnabled property: Indicates whether always On availability groups is enabled in SQL Server. + * + * @return the isHadrEnabled value. + */ + public Boolean isHadrEnabled() { + return this.isHadrEnabled; + } + + /** + * Get the traceFlags property: An array of integers, where each value represents the enabled trace flags in SQL + * Server. + * + * @return the traceFlags value. + */ + public List traceFlags() { + return this.traceFlags; + } + + /** + * Get the currentVersion property: SQL Server current version. + * + * @return the currentVersion value. + */ + public String currentVersion() { + return this.currentVersion; + } + + /** + * Get the instanceName property: SQL Server instance name. + * + * @return the instanceName value. + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Set the instanceName property: SQL Server instance name. + * + * @param instanceName the instanceName value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withInstanceName(String instanceName) { + this.instanceName = instanceName; + return this; + } + + /** + * Get the tcpDynamicPorts property: Dynamic TCP ports used by SQL Server. + * + * @return the tcpDynamicPorts value. + */ + public String tcpDynamicPorts() { + return this.tcpDynamicPorts; + } + + /** + * Get the tcpStaticPorts property: Static TCP ports used by SQL Server. + * + * @return the tcpStaticPorts value. + */ + public String tcpStaticPorts() { + return this.tcpStaticPorts; + } + + /** + * Get the productId property: SQL Server product ID. + * + * @return the productId value. + */ + public String productId() { + return this.productId; + } + + /** + * Get the licenseType property: SQL Server license type. + * + * @return the licenseType value. + */ + public ArcSqlServerLicenseType licenseType() { + return this.licenseType; + } + + /** + * Get the azureDefenderStatusLastUpdated property: Timestamp of last Azure Defender status update. + * + * @return the azureDefenderStatusLastUpdated value. + */ + public OffsetDateTime azureDefenderStatusLastUpdated() { + return this.azureDefenderStatusLastUpdated; + } + + /** + * Get the azureDefenderStatus property: Status of Azure Defender. + * + * @return the azureDefenderStatus value. + */ + public DefenderStatus azureDefenderStatus() { + return this.azureDefenderStatus; + } + + /** + * Get the provisioningState property: The provisioning state of the Arc-enabled SQL Server resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the lastInventoryUploadTime property: The time when last successful inventory upload was performed. + * + * @return the lastInventoryUploadTime value. + */ + public OffsetDateTime lastInventoryUploadTime() { + return this.lastInventoryUploadTime; + } + + /** + * Get the lastUsageUploadTime property: The time when last successful usage upload was performed. + * + * @return the lastUsageUploadTime value. + */ + public OffsetDateTime lastUsageUploadTime() { + return this.lastUsageUploadTime; + } + + /** + * Get the hostType property: Type of host for Azure Arc SQL Server. + * + * @return the hostType value. + */ + public HostType hostType() { + return this.hostType; + } + + /** + * Set the hostType property: Type of host for Azure Arc SQL Server. + * + * @param hostType the hostType value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withHostType(HostType hostType) { + this.hostType = hostType; + return this; + } + + /** + * Get the alwaysOnRole property: The role of the SQL Server, based on availability. + * + * @return the alwaysOnRole value. + */ + public AlwaysOnRole alwaysOnRole() { + return this.alwaysOnRole; + } + + /** + * Get the failoverCluster property: Failover Cluster Instance properties. + * + * @return the failoverCluster value. + */ + public FailoverCluster failoverCluster() { + return this.failoverCluster; + } + + /** + * Set the failoverCluster property: Failover Cluster Instance properties. + * + * @param failoverCluster the failoverCluster value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withFailoverCluster(FailoverCluster failoverCluster) { + this.failoverCluster = failoverCluster; + return this; + } + + /** + * Get the backupPolicy property: The backup profile for the SQL server. + * + * @return the backupPolicy value. + */ + public BackupPolicy backupPolicy() { + return this.backupPolicy; + } + + /** + * Set the backupPolicy property: The backup profile for the SQL server. + * + * @param backupPolicy the backupPolicy value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withBackupPolicy(BackupPolicy backupPolicy) { + this.backupPolicy = backupPolicy; + return this; + } + + /** + * Get the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. + * + * @return the upgradeLockedUntil value. + */ + public OffsetDateTime upgradeLockedUntil() { + return this.upgradeLockedUntil; + } + + /** + * Set the upgradeLockedUntil property: Upgrade Action for this resource is locked until it expires. The Expiration + * time indicated by this value. It is not locked when it is empty. + * + * @param upgradeLockedUntil the upgradeLockedUntil value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withUpgradeLockedUntil(OffsetDateTime upgradeLockedUntil) { + this.upgradeLockedUntil = upgradeLockedUntil; + return this; + } + + /** + * Get the monitoring property: The monitoring configuration. + * + * @return the monitoring value. + */ + public Monitoring monitoring() { + return this.monitoring; + } + + /** + * Set the monitoring property: The monitoring configuration. + * + * @param monitoring the monitoring value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withMonitoring(Monitoring monitoring) { + this.monitoring = monitoring; + return this; + } + + /** + * Get the migration property: Migration related configuration. + * + * @return the migration value. + */ + public Migration migration() { + return this.migration; + } + + /** + * Set the migration property: Migration related configuration. + * + * @param migration the migration value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withMigration(Migration migration) { + this.migration = migration; + return this; + } + + /** + * Get the bestPracticesAssessment property: The configuration related to SQL best practices assessment. + * + * @return the bestPracticesAssessment value. + */ + public BestPracticesAssessment bestPracticesAssessment() { + return this.bestPracticesAssessment; + } + + /** + * Set the bestPracticesAssessment property: The configuration related to SQL best practices assessment. + * + * @param bestPracticesAssessment the bestPracticesAssessment value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties + withBestPracticesAssessment(BestPracticesAssessment bestPracticesAssessment) { + this.bestPracticesAssessment = bestPracticesAssessment; + return this; + } + + /** + * Get the clientConnection property: Client connection related configuration. + * + * @return the clientConnection value. + */ + public ClientConnection clientConnection() { + return this.clientConnection; + } + + /** + * Set the clientConnection property: Client connection related configuration. + * + * @param clientConnection the clientConnection value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withClientConnection(ClientConnection clientConnection) { + this.clientConnection = clientConnection; + return this; + } + + /** + * Get the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @return the serviceType value. + */ + public ServiceType serviceType() { + return this.serviceType; + } + + /** + * Set the serviceType property: Indicates if the resource represents a SQL Server engine or a SQL Server component + * service installed on the host. + * + * @param serviceType the serviceType value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Get the authentication property: Authentication related configuration for the SQL Server Instance. + * + * @return the authentication value. + */ + public Authentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: Authentication related configuration for the SQL Server Instance. + * + * @param authentication the authentication value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withAuthentication(Authentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the databaseMirroringEndpoint property: Database mirroring endpoint related properties. + * + * @return the databaseMirroringEndpoint value. + */ + public DBMEndpoint databaseMirroringEndpoint() { + return this.databaseMirroringEndpoint; + } + + /** + * Set the databaseMirroringEndpoint property: Database mirroring endpoint related properties. + * + * @param databaseMirroringEndpoint the databaseMirroringEndpoint value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withDatabaseMirroringEndpoint(DBMEndpoint databaseMirroringEndpoint) { + this.databaseMirroringEndpoint = databaseMirroringEndpoint; + return this; + } + + /** + * Get the isMicrosoftPkiCertTrustConfigured property: Indicates whether Microsoft PKI root-authority certificate + * (trusted by Azure) exists in SQL Server and trusted for Azure database.windows.net domains. + * + * @return the isMicrosoftPkiCertTrustConfigured value. + */ + public Boolean isMicrosoftPkiCertTrustConfigured() { + return this.isMicrosoftPkiCertTrustConfigured; + } + + /** + * Set the isMicrosoftPkiCertTrustConfigured property: Indicates whether Microsoft PKI root-authority certificate + * (trusted by Azure) exists in SQL Server and trusted for Azure database.windows.net domains. + * + * @param isMicrosoftPkiCertTrustConfigured the isMicrosoftPkiCertTrustConfigured value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties + withIsMicrosoftPkiCertTrustConfigured(Boolean isMicrosoftPkiCertTrustConfigured) { + this.isMicrosoftPkiCertTrustConfigured = isMicrosoftPkiCertTrustConfigured; + return this; + } + + /** + * Get the isDigiCertPkiCertTrustConfigured property: Indicates whether DigiCert PKI root-authority certificate + * (trusted by Azure) exists in SQL Server and trusted for Azure database.windows.net domains. + * + * @return the isDigiCertPkiCertTrustConfigured value. + */ + public Boolean isDigiCertPkiCertTrustConfigured() { + return this.isDigiCertPkiCertTrustConfigured; + } + + /** + * Set the isDigiCertPkiCertTrustConfigured property: Indicates whether DigiCert PKI root-authority certificate + * (trusted by Azure) exists in SQL Server and trusted for Azure database.windows.net domains. + * + * @param isDigiCertPkiCertTrustConfigured the isDigiCertPkiCertTrustConfigured value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties + withIsDigiCertPkiCertTrustConfigured(Boolean isDigiCertPkiCertTrustConfigured) { + this.isDigiCertPkiCertTrustConfigured = isDigiCertPkiCertTrustConfigured; + return this; + } + + /** + * Get the maxServerMemoryMB property: maximum server memory (MB) value configured for this instance. + * + * @return the maxServerMemoryMB value. + */ + public Long maxServerMemoryMB() { + return this.maxServerMemoryMB; + } + + /** + * Set the maxServerMemoryMB property: maximum server memory (MB) value configured for this instance. + * + * @param maxServerMemoryMB the maxServerMemoryMB value to set. + * @return the SqlServerInstanceUpdateProperties object itself. + */ + public SqlServerInstanceUpdateProperties withMaxServerMemoryMB(Long maxServerMemoryMB) { + this.maxServerMemoryMB = maxServerMemoryMB; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeStringField("edition", this.edition == null ? null : this.edition.toString()); + jsonWriter.writeStringField("cores", this.cores); + jsonWriter.writeStringField("discoverySource", + this.discoverySource == null ? null : this.discoverySource.toString()); + jsonWriter.writeStringField("instanceName", this.instanceName); + jsonWriter.writeStringField("hostType", this.hostType == null ? null : this.hostType.toString()); + jsonWriter.writeJsonField("failoverCluster", this.failoverCluster); + jsonWriter.writeJsonField("backupPolicy", this.backupPolicy); + jsonWriter.writeStringField("upgradeLockedUntil", + this.upgradeLockedUntil == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.upgradeLockedUntil)); + jsonWriter.writeJsonField("monitoring", this.monitoring); + jsonWriter.writeJsonField("migration", this.migration); + jsonWriter.writeJsonField("bestPracticesAssessment", this.bestPracticesAssessment); + jsonWriter.writeJsonField("clientConnection", this.clientConnection); + jsonWriter.writeStringField("serviceType", this.serviceType == null ? null : this.serviceType.toString()); + jsonWriter.writeJsonField("authentication", this.authentication); + jsonWriter.writeJsonField("databaseMirroringEndpoint", this.databaseMirroringEndpoint); + jsonWriter.writeBooleanField("isMicrosoftPkiCertTrustConfigured", this.isMicrosoftPkiCertTrustConfigured); + jsonWriter.writeBooleanField("isDigiCertPkiCertTrustConfigured", this.isDigiCertPkiCertTrustConfigured); + jsonWriter.writeNumberField("maxServerMemoryMB", this.maxServerMemoryMB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerInstanceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerInstanceUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerInstanceUpdateProperties. + */ + public static SqlServerInstanceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerInstanceUpdateProperties deserializedSqlServerInstanceUpdateProperties + = new SqlServerInstanceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.version = SqlVersion.fromString(reader.getString()); + } else if ("edition".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.edition = EditionType.fromString(reader.getString()); + } else if ("containerResourceId".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.containerResourceId = reader.getString(); + } else if ("vmId".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.vmId = reader.getString(); + } else if ("createTime".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.createTime = reader.getString(); + } else if ("vCore".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.vCore = reader.getString(); + } else if ("cores".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.cores = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.status + = ConnectionStatus.fromString(reader.getString()); + } else if ("discoverySource".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.discoverySource + = DiscoverySource.fromString(reader.getString()); + } else if ("patchLevel".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.patchLevel = reader.getString(); + } else if ("collation".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.collation = reader.getString(); + } else if ("dbMasterKeyExists".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.dbMasterKeyExists + = reader.getNullable(JsonReader::getBoolean); + } else if ("isHadrEnabled".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.isHadrEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("traceFlags".equals(fieldName)) { + List traceFlags = reader.readArray(reader1 -> reader1.getInt()); + deserializedSqlServerInstanceUpdateProperties.traceFlags = traceFlags; + } else if ("currentVersion".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.currentVersion = reader.getString(); + } else if ("instanceName".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.instanceName = reader.getString(); + } else if ("tcpDynamicPorts".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.tcpDynamicPorts = reader.getString(); + } else if ("tcpStaticPorts".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.tcpStaticPorts = reader.getString(); + } else if ("productId".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.productId = reader.getString(); + } else if ("licenseType".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.licenseType + = ArcSqlServerLicenseType.fromString(reader.getString()); + } else if ("azureDefenderStatusLastUpdated".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.azureDefenderStatusLastUpdated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("azureDefenderStatus".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.azureDefenderStatus + = DefenderStatus.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.provisioningState = reader.getString(); + } else if ("lastInventoryUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.lastInventoryUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastUsageUploadTime".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.lastUsageUploadTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("hostType".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.hostType = HostType.fromString(reader.getString()); + } else if ("alwaysOnRole".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.alwaysOnRole + = AlwaysOnRole.fromString(reader.getString()); + } else if ("failoverCluster".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.failoverCluster = FailoverCluster.fromJson(reader); + } else if ("backupPolicy".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.backupPolicy = BackupPolicy.fromJson(reader); + } else if ("upgradeLockedUntil".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.upgradeLockedUntil = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("monitoring".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.monitoring = Monitoring.fromJson(reader); + } else if ("migration".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.migration = Migration.fromJson(reader); + } else if ("bestPracticesAssessment".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.bestPracticesAssessment + = BestPracticesAssessment.fromJson(reader); + } else if ("clientConnection".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.clientConnection = ClientConnection.fromJson(reader); + } else if ("serviceType".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.serviceType + = ServiceType.fromString(reader.getString()); + } else if ("authentication".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.authentication = Authentication.fromJson(reader); + } else if ("databaseMirroringEndpoint".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.databaseMirroringEndpoint + = DBMEndpoint.fromJson(reader); + } else if ("isMicrosoftPkiCertTrustConfigured".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.isMicrosoftPkiCertTrustConfigured + = reader.getNullable(JsonReader::getBoolean); + } else if ("isDigiCertPkiCertTrustConfigured".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.isDigiCertPkiCertTrustConfigured + = reader.getNullable(JsonReader::getBoolean); + } else if ("maxServerMemoryMB".equals(fieldName)) { + deserializedSqlServerInstanceUpdateProperties.maxServerMemoryMB + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerInstanceUpdateProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java index 9729d0a2a98f..27bbe54976ff 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java @@ -1,47 +1,77 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import java.util.List; /** * Resource collection API of SqlServerInstances. */ public interface SqlServerInstances { /** - * List sqlServerInstance resources in the subscription. + * Retrieves a SQL Server Instance resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + * @return a SqlServerInstance along with {@link Response}. */ - PagedIterable list(); + Response getByResourceGroupWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); /** - * List sqlServerInstance resources in the subscription. + * Retrieves a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance getByResourceGroup(String resourceGroupName, String sqlServerInstanceName); + + /** + * Deletes a SQL Server Instance resource. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String sqlServerInstanceName); + + /** + * Deletes a SQL Server Instance resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. */ - PagedIterable list(Context context); + void delete(String resourceGroupName, String sqlServerInstanceName, Context context); /** * List sqlServerInstance resources in the resource group * * Gets all sqlServerInstances in a resource group. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedIterable}. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); @@ -50,19 +80,373 @@ public interface SqlServerInstances { * * Gets all sqlServerInstances in a resource group. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all sqlServerInstances in a resource group as paginated response with {@link PagedIterable}. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Retrieves a SQL Server Instance resource. + * List sqlServerInstance resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List sqlServerInstance resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SqlServerInstance as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest); + + /** + * Retrieves SQL Server instance telemetry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTelemetryRequest Contains the parameters to get SQL Server instance telemetry. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getTelemetry(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceTelemetryRequest sqlServerInstanceTelemetryRequest, Context context); + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getBestPracticesAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest); + + /** + * Retrieves SQL best practices assessment results for the SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceBpaRequest The request to fetch the SQL best practices assessment results. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable> getBestPracticesAssessment(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceBpaRequest sqlServerInstanceBpaRequest, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance along with {@link Response}. + */ + Response + runMigrationAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * Runs migration assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response for running migration assessment on the SQL Server instance. + */ + SqlServerInstanceRunMigrationAssessmentResponse runMigrationAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Starts a target recommendation job for the SQL Server instance. Only one job can run at a time. If the previous + * job is in a non-terminal state (NotStarted or InProgress), calling this operation again returns the existing job + * status without creating a new job. A new job is created only when the previous job has reached a terminal state + * (Succeeded or Failed). This operation does not return recommendations directly. Use the + * GetTargetRecommendationReports API to check the job status and retrieve the target recommendation report if the + * jobStatus is Succeeded. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceRunTargetRecommendationJobRequest Contains the parameters to run SQL Server instance + * target recommendation job. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunTargetRecommendationJobResponse runTargetRecommendationJob(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceRunTargetRecommendationJobRequest sqlServerInstanceRunTargetRecommendationJobRequest, + Context context); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Retrieves the current job status and the latest target recommendation report for the SQL Server instance. The + * response always includes the jobStatus field, which indicates the state of the most recent target recommendation + * job (NotStarted, InProgress, Succeeded, or Failed). The report data is included in the response only when the + * jobStatus is Succeeded. A target recommendation job must be started using the RunTargetRecommendationJob API + * before calling this API. Only the most recent report is returned. If the report contains more sections than can + * be returned in a single response, use the nextReportOffset and nextSectionOffset values from the response to + * retrieve the remaining data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceTargetRecommendationReportsRequest Contains the parameters to get SQL Server instance + * target recommendation reports. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceTargetRecommendationReportsResponse getTargetRecommendationReports(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceTargetRecommendationReportsRequest sqlServerInstanceTargetRecommendationReportsRequest, + Context context); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Retrieves the migration readiness report for the SQL Server instance. The report contains an assessment of the + * instance's readiness for migration to Azure SQL targets. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceMigrationReadinessReportResponse getMigrationReadinessReport(String resourceGroupName, + String sqlServerInstanceName, Context context); + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment along with {@link Response}. + */ + Response + runBestPracticesAssessmentWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); + + /** + * The request to run SQL best practices assessment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response object for the request to run SQL best practices assessment. + */ + SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticesAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * The request to run SQL best practices assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunBestPracticesAssessmentResponse runBestPracticeAssessment(String resourceGroupName, + String sqlServerInstanceName, Context context); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunMigrationReadinessAssessmentResponse runMigrationReadinessAssessment(String resourceGroupName, + String sqlServerInstanceName); + + /** + * The request to run migration readiness assessment asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceRunMigrationReadinessAssessmentResponse runMigrationReadinessAssessment(String resourceGroupName, + String sqlServerInstanceName, Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsStatusRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource along with {@link Response}. + */ + Response getJobsStatusWithResponse(String resourceGroupName, + String sqlServerInstanceName, SqlServerInstanceJobsStatusRequest sqlServerInstanceJobsStatusRequest, + Context context); + + /** + * Gets jobs status details for sql arc resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return jobs status details for sql arc resource. + */ + SqlServerInstanceJobsStatusResponse getJobsStatus(String resourceGroupName, String sqlServerInstanceName); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + SqlServerInstanceJobsResponse getJobs(String resourceGroupName, String sqlServerInstanceName); + + /** + * Gets job details for sql arc resource asynchronously. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceJobsRequest Contains the parameters to get SQL Server instance agent jobs status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return job details for sql arc resource asynchronously. + */ + SqlServerInstanceJobsResponse getJobs(String resourceGroupName, String sqlServerInstanceName, + SqlServerInstanceJobsRequest sqlServerInstanceJobsRequest, Context context); + + /** + * Request Upgrade Permission before upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -70,43 +454,109 @@ public interface SqlServerInstances { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlServerInstance along with {@link Response}. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String sqlServerInstanceName, + Response preUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, Context context); /** - * Retrieves a SQL Server Instance resource. + * Request Upgrade Permission before upgrading. * - * @param resourceGroupName The name of the Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param sqlServerInstanceName Name of SQL Server Instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a SqlServerInstance. */ - SqlServerInstance getByResourceGroup(String resourceGroupName, String sqlServerInstanceName); + SqlServerInstance preUpgrade(String resourceGroupName, String sqlServerInstanceName); /** - * Deletes a SQL Server Instance resource. + * Clean up after upgrading. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance along with {@link Response}. */ - void deleteByResourceGroup(String resourceGroupName, String sqlServerInstanceName); + Response postUpgradeWithResponse(String resourceGroupName, String sqlServerInstanceName, + Context context); /** - * Deletes a SQL Server Instance resource. + * Clean up after upgrading. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SqlServerInstance. + */ + SqlServerInstance postUpgrade(String resourceGroupName, String sqlServerInstanceName); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. * - * @param resourceGroupName The name of the Azure resource group. - * @param sqlServerInstanceName The name of SQL Server Instance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest); + + /** + * Runs Managed Instance Link assessment for SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param sqlServerInstanceManagedInstanceLinkAssessmentRequest Contains the parameters to run SQL Server instance + * MI link assessment. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. */ - void delete(String resourceGroupName, String sqlServerInstanceName, Context context); + SqlServerInstanceManagedInstanceLinkAssessmentResponse runManagedInstanceLinkAssessment(String resourceGroupName, + String sqlServerInstanceName, + SqlServerInstanceManagedInstanceLinkAssessmentRequest sqlServerInstanceManagedInstanceLinkAssessmentRequest, + Context context); + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName); + + /** + * Retrieves full properties of all the Availability Groups in a SQL Server instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerInstanceName Name of SQL Server Instance. + * @param availabilityGroupRetrievalFilters The availabilityGroupRetrievalFilters parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Arc Sql Server Availability Groups as paginated response with {@link PagedIterable}. + */ + PagedIterable getAllAvailabilityGroups(String resourceGroupName, + String sqlServerInstanceName, AvailabilityGroupRetrievalFilters availabilityGroupRetrievalFilters, + Context context); /** * Retrieves a SQL Server Instance resource. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java new file mode 100644 index 000000000000..3e55c645d1d6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import java.util.Map; + +/** + * An immutable client-side representation of SqlServerLicense. + */ +public interface SqlServerLicense { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: SQL Server license properties. + * + * @return the properties value. + */ + SqlServerLicenseProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner object. + * + * @return the inner object. + */ + SqlServerLicenseInner innerModel(); + + /** + * The entirety of the SqlServerLicense definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * The SqlServerLicense definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SqlServerLicense definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SqlServerLicense definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the SqlServerLicense definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the SqlServerLicense definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: SQL Server license properties. + * + * @param properties SQL Server license properties. + * @return the next definition stage. + */ + WithCreate withProperties(SqlServerLicenseProperties properties); + } + + /** + * The stage of the SqlServerLicense definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlServerLicense create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlServerLicense create(Context context); + } + + /** + * The stage of the SqlServerLicense definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + + /** + * Begins update for the SqlServerLicense resource. + * + * @return the stage of resource update. + */ + SqlServerLicense.Update update(); + + /** + * The template for SqlServerLicense update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlServerLicense apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlServerLicense apply(Context context); + } + + /** + * The SqlServerLicense update stages. + */ + interface UpdateStages { + /** + * The stage of the SqlServerLicense update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the SqlServerLicense update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: null. + * + * @param properties null. + * @return the next definition stage. + */ + Update withProperties(SqlServerLicenseUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlServerLicense refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlServerLicense refresh(Context context); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java new file mode 100644 index 000000000000..d17f2b6931a3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of SQL Server License. + */ +@Fluent +public final class SqlServerLicenseProperties implements JsonSerializable { + /* + * SQL Server license type. + */ + private BillingPlan billingPlan; + + /* + * The number of total cores of the license covers. + */ + private int physicalCores; + + /* + * This property represents the choice between SQL Server Core and ESU licenses. + */ + private LicenseCategory licenseCategory; + + /* + * The activation state of the license. + */ + private ActivationState activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the most recent activation of the SqlServerLicense. + */ + private OffsetDateTime lastActivatedAt; + + /* + * The timestamp of the most recent deactivation of the SqlServerLicense. + */ + private OffsetDateTime lastDeactivatedAt; + + /* + * The tenantId the SQL Server license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerLicenseProperties class. + */ + public SqlServerLicenseProperties() { + } + + /** + * Get the billingPlan property: SQL Server license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public int physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withPhysicalCores(int physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @return the licenseCategory value. + */ + public LicenseCategory licenseCategory() { + return this.licenseCategory; + } + + /** + * Set the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @param licenseCategory the licenseCategory value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withLicenseCategory(LicenseCategory licenseCategory) { + this.licenseCategory = licenseCategory; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public ActivationState activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withActivationState(ActivationState activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerLicenseProperties object itself. + */ + public SqlServerLicenseProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the lastActivatedAt property: The timestamp of the most recent activation of the SqlServerLicense. + * + * @return the lastActivatedAt value. + */ + public OffsetDateTime lastActivatedAt() { + return this.lastActivatedAt; + } + + /** + * Get the lastDeactivatedAt property: The timestamp of the most recent deactivation of the SqlServerLicense. + * + * @return the lastDeactivatedAt value. + */ + public OffsetDateTime lastDeactivatedAt() { + return this.lastDeactivatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeIntField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("licenseCategory", + this.licenseCategory == null ? null : this.licenseCategory.toString()); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SqlServerLicenseProperties. + */ + public static SqlServerLicenseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseProperties deserializedSqlServerLicenseProperties = new SqlServerLicenseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerLicenseProperties.billingPlan = BillingPlan.fromString(reader.getString()); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerLicenseProperties.physicalCores = reader.getInt(); + } else if ("licenseCategory".equals(fieldName)) { + deserializedSqlServerLicenseProperties.licenseCategory + = LicenseCategory.fromString(reader.getString()); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerLicenseProperties.activationState + = ActivationState.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerLicenseProperties.scopeType = ScopeType.fromString(reader.getString()); + } else if ("lastActivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseProperties.lastActivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastDeactivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseProperties.lastDeactivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerLicenseProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java new file mode 100644 index 000000000000..ccb87c3074b9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * An update to a SQL Server license resource. + */ +@Fluent +public final class SqlServerLicenseUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * null + */ + private SqlServerLicenseUpdateProperties properties; + + /** + * Creates an instance of SqlServerLicenseUpdate class. + */ + public SqlServerLicenseUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SqlServerLicenseUpdate object itself. + */ + public SqlServerLicenseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: null. + * + * @return the properties value. + */ + public SqlServerLicenseUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: null. + * + * @param properties the properties value to set. + * @return the SqlServerLicenseUpdate object itself. + */ + public SqlServerLicenseUpdate withProperties(SqlServerLicenseUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerLicenseUpdate. + */ + public static SqlServerLicenseUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseUpdate deserializedSqlServerLicenseUpdate = new SqlServerLicenseUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSqlServerLicenseUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSqlServerLicenseUpdate.properties = SqlServerLicenseUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseUpdate; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java new file mode 100644 index 000000000000..3db73252a11b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of update SqlServerLicense. + */ +@Fluent +public final class SqlServerLicenseUpdateProperties implements JsonSerializable { + /* + * SQL Server license type. + */ + private BillingPlan billingPlan; + + /* + * The number of total cores of the license covers. + */ + private Integer physicalCores; + + /* + * This property represents the choice between SQL Server Core and ESU licenses. + */ + private LicenseCategory licenseCategory; + + /* + * The activation state of the license. + */ + private ActivationState activationState; + + /* + * The Azure scope to which the license will apply. + */ + private ScopeType scopeType; + + /* + * The timestamp of the most recent activation of the SqlServerLicense. + */ + private OffsetDateTime lastActivatedAt; + + /* + * The timestamp of the most recent deactivation of the SqlServerLicense. + */ + private OffsetDateTime lastDeactivatedAt; + + /* + * The tenantId the SQL Server license resource subscription resides in. + */ + private String tenantId; + + /** + * Creates an instance of SqlServerLicenseUpdateProperties class. + */ + public SqlServerLicenseUpdateProperties() { + } + + /** + * Get the billingPlan property: SQL Server license type. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: SQL Server license type. + * + * @param billingPlan the billingPlan value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the physicalCores property: The number of total cores of the license covers. + * + * @return the physicalCores value. + */ + public Integer physicalCores() { + return this.physicalCores; + } + + /** + * Set the physicalCores property: The number of total cores of the license covers. + * + * @param physicalCores the physicalCores value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withPhysicalCores(Integer physicalCores) { + this.physicalCores = physicalCores; + return this; + } + + /** + * Get the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @return the licenseCategory value. + */ + public LicenseCategory licenseCategory() { + return this.licenseCategory; + } + + /** + * Set the licenseCategory property: This property represents the choice between SQL Server Core and ESU licenses. + * + * @param licenseCategory the licenseCategory value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withLicenseCategory(LicenseCategory licenseCategory) { + this.licenseCategory = licenseCategory; + return this; + } + + /** + * Get the activationState property: The activation state of the license. + * + * @return the activationState value. + */ + public ActivationState activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the license. + * + * @param activationState the activationState value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withActivationState(ActivationState activationState) { + this.activationState = activationState; + return this; + } + + /** + * Get the scopeType property: The Azure scope to which the license will apply. + * + * @return the scopeType value. + */ + public ScopeType scopeType() { + return this.scopeType; + } + + /** + * Set the scopeType property: The Azure scope to which the license will apply. + * + * @param scopeType the scopeType value to set. + * @return the SqlServerLicenseUpdateProperties object itself. + */ + public SqlServerLicenseUpdateProperties withScopeType(ScopeType scopeType) { + this.scopeType = scopeType; + return this; + } + + /** + * Get the lastActivatedAt property: The timestamp of the most recent activation of the SqlServerLicense. + * + * @return the lastActivatedAt value. + */ + public OffsetDateTime lastActivatedAt() { + return this.lastActivatedAt; + } + + /** + * Get the lastDeactivatedAt property: The timestamp of the most recent deactivation of the SqlServerLicense. + * + * @return the lastDeactivatedAt value. + */ + public OffsetDateTime lastDeactivatedAt() { + return this.lastDeactivatedAt; + } + + /** + * Get the tenantId property: The tenantId the SQL Server license resource subscription resides in. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("billingPlan", this.billingPlan == null ? null : this.billingPlan.toString()); + jsonWriter.writeNumberField("physicalCores", this.physicalCores); + jsonWriter.writeStringField("licenseCategory", + this.licenseCategory == null ? null : this.licenseCategory.toString()); + jsonWriter.writeStringField("activationState", + this.activationState == null ? null : this.activationState.toString()); + jsonWriter.writeStringField("scopeType", this.scopeType == null ? null : this.scopeType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SqlServerLicenseUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SqlServerLicenseUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SqlServerLicenseUpdateProperties. + */ + public static SqlServerLicenseUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SqlServerLicenseUpdateProperties deserializedSqlServerLicenseUpdateProperties + = new SqlServerLicenseUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("billingPlan".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.billingPlan + = BillingPlan.fromString(reader.getString()); + } else if ("physicalCores".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.physicalCores = reader.getNullable(JsonReader::getInt); + } else if ("licenseCategory".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.licenseCategory + = LicenseCategory.fromString(reader.getString()); + } else if ("activationState".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.activationState + = ActivationState.fromString(reader.getString()); + } else if ("scopeType".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.scopeType = ScopeType.fromString(reader.getString()); + } else if ("lastActivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.lastActivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastDeactivatedAt".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.lastDeactivatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedSqlServerLicenseUpdateProperties.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSqlServerLicenseUpdateProperties; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java new file mode 100644 index 000000000000..f69314a28196 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SqlServerLicenses. + */ +public interface SqlServerLicenses { + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String sqlServerLicenseName, + Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource. + */ + SqlServerLicense getByResourceGroup(String resourceGroupName, String sqlServerLicenseName); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String sqlServerLicenseName, + Context context); + + /** + * Deletes a SQL Server license resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sqlServerLicenseName Name of SQL Server License. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String sqlServerLicenseName); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List sqlServerLicense resources in the resource group + * + * Gets all sqlServerLicenses in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List sqlServerLicense resources in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List sqlServerLicense resources in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Server licenses as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Retrieves a SQL Server license resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + SqlServerLicense getById(String id); + + /** + * Retrieves a SQL Server license resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describe SQL Server license resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a SQL Server license resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a SQL Server license resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlServerLicense resource. + * + * @param name resource name. + * @return the first stage of the new SqlServerLicense definition. + */ + SqlServerLicense.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java index 70256d159dbc..4ddf6001f312 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -12,19 +12,44 @@ */ public final class SqlVersion extends ExpandableStringEnum { /** - * Static value SQL Server 2019 for SqlVersion. + * Unknown. */ - public static final SqlVersion SQL_SERVER_2019 = fromString("SQL Server 2019"); + public static final SqlVersion UNKNOWN = fromString("Unknown"); /** - * Static value SQL Server 2017 for SqlVersion. + * SQL Server 2012. */ - public static final SqlVersion SQL_SERVER_2017 = fromString("SQL Server 2017"); + public static final SqlVersion SQLSERVER2012 = fromString("SQL Server 2012"); /** - * Static value SQL Server 2016 for SqlVersion. + * SQL Server 2014. */ - public static final SqlVersion SQL_SERVER_2016 = fromString("SQL Server 2016"); + public static final SqlVersion SQLSERVER2014 = fromString("SQL Server 2014"); + + /** + * SQL Server 2016. + */ + public static final SqlVersion SQLSERVER2016 = fromString("SQL Server 2016"); + + /** + * SQL Server 2017. + */ + public static final SqlVersion SQLSERVER2017 = fromString("SQL Server 2017"); + + /** + * SQL Server 2019. + */ + public static final SqlVersion SQLSERVER2019 = fromString("SQL Server 2019"); + + /** + * SQL Server 2022. + */ + public static final SqlVersion SQLSERVER2022 = fromString("SQL Server 2022"); + + /** + * SQL Server 2025. + */ + public static final SqlVersion SQLSERVER2025 = fromString("SQL Server 2025"); /** * Creates a new instance of SqlVersion value. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java new file mode 100644 index 000000000000..2fc200c41940 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The activation state of the license. + */ +public final class State extends ExpandableStringEnum { + /** + * Inactive. + */ + public static final State INACTIVE = fromString("Inactive"); + + /** + * Active. + */ + public static final State ACTIVE = fromString("Active"); + + /** + * Terminated. + */ + public static final State TERMINATED = fromString("Terminated"); + + /** + * Enabled. + */ + public static final State ENABLED = fromString("Enabled"); + + /** + * Disabled. + */ + public static final State DISABLED = fromString("Disabled"); + + /** + * Deleted. + */ + public static final State DELETED = fromString("Deleted"); + + /** + * Completed. + */ + public static final State COMPLETED = fromString("Completed"); + + /** + * Faulted. + */ + public static final State FAULTED = fromString("Faulted"); + + /** + * Suspended. + */ + public static final State SUSPENDED = fromString("Suspended"); + + /** + * Creates a new instance of State value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public State() { + } + + /** + * Creates or finds a State from its string representation. + * + * @param name a name to look for. + * @return the corresponding State. + */ + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * Gets known State values. + * + * @return known State values. + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java new file mode 100644 index 000000000000..d061c9dd5002 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The target readiness for migration for this database. + */ +@Immutable +public final class TargetReadiness implements JsonSerializable { + /* + * The SKU recommendation summary. + */ + private SkuRecommendationSummary azureSqlDatabase; + + /* + * The SKU recommendation summary. + */ + private SkuRecommendationSummary azureSqlManagedInstance; + + /* + * The SKU recommendation summary. + */ + private SkuRecommendationSummary azureSqlVirtualMachine; + + /** + * Creates an instance of TargetReadiness class. + */ + private TargetReadiness() { + } + + /** + * Get the azureSqlDatabase property: The SKU recommendation summary. + * + * @return the azureSqlDatabase value. + */ + public SkuRecommendationSummary azureSqlDatabase() { + return this.azureSqlDatabase; + } + + /** + * Get the azureSqlManagedInstance property: The SKU recommendation summary. + * + * @return the azureSqlManagedInstance value. + */ + public SkuRecommendationSummary azureSqlManagedInstance() { + return this.azureSqlManagedInstance; + } + + /** + * Get the azureSqlVirtualMachine property: The SKU recommendation summary. + * + * @return the azureSqlVirtualMachine value. + */ + public SkuRecommendationSummary azureSqlVirtualMachine() { + return this.azureSqlVirtualMachine; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("azureSqlDatabase", this.azureSqlDatabase); + jsonWriter.writeJsonField("azureSqlManagedInstance", this.azureSqlManagedInstance); + jsonWriter.writeJsonField("azureSqlVirtualMachine", this.azureSqlVirtualMachine); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetReadiness from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetReadiness if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetReadiness. + */ + public static TargetReadiness fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetReadiness deserializedTargetReadiness = new TargetReadiness(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureSqlDatabase".equals(fieldName)) { + deserializedTargetReadiness.azureSqlDatabase = SkuRecommendationSummary.fromJson(reader); + } else if ("azureSqlManagedInstance".equals(fieldName)) { + deserializedTargetReadiness.azureSqlManagedInstance = SkuRecommendationSummary.fromJson(reader); + } else if ("azureSqlVirtualMachine".equals(fieldName)) { + deserializedTargetReadiness.azureSqlVirtualMachine = SkuRecommendationSummary.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetReadiness; + }); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetType.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetType.java new file mode 100644 index 000000000000..00a86a6bf024 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of target in Azure this database is being migrated to. + */ +public final class TargetType extends ExpandableStringEnum { + /** + * AzureSqlDatabase. + */ + public static final TargetType AZURE_SQL_DATABASE = fromString("AzureSqlDatabase"); + + /** + * AzureSqlManagedInstance. + */ + public static final TargetType AZURE_SQL_MANAGED_INSTANCE = fromString("AzureSqlManagedInstance"); + + /** + * AzureSqlVirtualMachine. + */ + public static final TargetType AZURE_SQL_VIRTUAL_MACHINE = fromString("AzureSqlVirtualMachine"); + + /** + * Creates a new instance of TargetType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TargetType() { + } + + /** + * Creates or finds a TargetType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TargetType. + */ + public static TargetType fromString(String name) { + return fromString(name, TargetType.class); + } + + /** + * Gets known TargetType values. + * + * @return known TargetType values. + */ + public static Collection values() { + return values(TargetType.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java index 1002ef63302c..477b8bbec41c 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -10,8 +10,6 @@ import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; -import java.util.Objects; -import java.util.UUID; /** * Service principal for uploading billing, metrics and logs. @@ -21,12 +19,12 @@ public final class UploadServicePrincipal implements JsonSerializable UUID.fromString(nonNullReader.getString())); + deserializedUploadServicePrincipal.clientId = reader.getString(); } else if ("tenantId".equals(fieldName)) { - deserializedUploadServicePrincipal.tenantId - = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + deserializedUploadServicePrincipal.tenantId = reader.getString(); } else if ("authority".equals(fieldName)) { deserializedUploadServicePrincipal.authority = reader.getString(); } else if ("clientSecret".equals(fieldName)) { diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java index 641e1dc45778..fb255e979777 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.models; @@ -100,14 +100,6 @@ public UploadWatermark withUsages(OffsetDateTime usages) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.java new file mode 100644 index 000000000000..ee9b18cdcbc5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The SQL Server version the license covers. + */ +public final class Version extends ExpandableStringEnum { + /** + * SQL Server 2012. + */ + public static final Version SQLSERVER2012 = fromString("SQL Server 2012"); + + /** + * SQL Server 2014. + */ + public static final Version SQLSERVER2014 = fromString("SQL Server 2014"); + + /** + * SQL Server 2016. + */ + public static final Version SQLSERVER2016 = fromString("SQL Server 2016"); + + /** + * Creates a new instance of Version value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Version() { + } + + /** + * Creates or finds a Version from its string representation. + * + * @param name a name to look for. + * @return the corresponding Version. + */ + public static Version fromString(String name) { + return fromString(name, Version.class); + } + + /** + * Gets known Version values. + * + * @return known Version values. + */ + public static Collection values() { + return values(Version.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java index f38a598a4bb8..f2cc7f675a52 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for AzureArcDataManagementClient. + * Package containing the data models for AzureArcData. * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc * Resources. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java index d6ef1b9ec709..a27a53be6bc3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the classes for AzureArcDataManagementClient. + * Package containing the classes for AzureArcData. * The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc * Resources. */ diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java index 13cc7832a889..d02ee5cdc8ac 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/java/module-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. module com.azure.resourcemanager.azurearcdata { requires transitive com.azure.core.management; @@ -12,4 +12,5 @@ opens com.azure.resourcemanager.azurearcdata.fluent.models to com.azure.core; opens com.azure.resourcemanager.azurearcdata.models to com.azure.core; + opens com.azure.resourcemanager.azurearcdata.implementation.models to com.azure.core; } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/azure-resourcemanager-azurearcdata_metadata.json b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/azure-resourcemanager-azurearcdata_metadata.json new file mode 100644 index 000000000000..a24d52b70799 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/azure-resourcemanager-azurearcdata_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.AzureArcData":"2026-03-01-preview"},"crossLanguagePackageId":"Microsoft.AzureArcData","crossLanguageVersion":"7d893ba19c68","crossLanguageDefinitions":{"com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.beginCreate":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.create","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.beginDelete":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.delete","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.create":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.create","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.delete":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.delete","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.get":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.get","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.getWithResponse":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.get","com.azure.resourcemanager.azurearcdata.fluent.ActiveDirectoryConnectorsClient.list":"Microsoft.AzureArcData.ActiveDirectoryConnectorResources.list","com.azure.resourcemanager.azurearcdata.fluent.AzureArcDataManagementClient":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.beginDelete":"Microsoft.AzureArcData.DataControllerResources.deleteDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.beginPatchDataController":"Microsoft.AzureArcData.DataControllerResources.patchDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.beginPutDataController":"Microsoft.AzureArcData.DataControllerResources.putDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.delete":"Microsoft.AzureArcData.DataControllerResources.deleteDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.getByResourceGroup":"Microsoft.AzureArcData.DataControllerResources.getDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.getByResourceGroupWithResponse":"Microsoft.AzureArcData.DataControllerResources.getDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.list":"Microsoft.AzureArcData.DataControllerResources.listInSubscription","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.listByResourceGroup":"Microsoft.AzureArcData.DataControllerResources.listInGroup","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.patchDataController":"Microsoft.AzureArcData.DataControllerResources.patchDataController","com.azure.resourcemanager.azurearcdata.fluent.DataControllersClient.putDataController":"Microsoft.AzureArcData.DataControllerResources.putDataController","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.beginCreate":"Microsoft.AzureArcData.FailoverGroupResources.create","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.beginDelete":"Microsoft.AzureArcData.FailoverGroupResources.delete","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.create":"Microsoft.AzureArcData.FailoverGroupResources.create","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.delete":"Microsoft.AzureArcData.FailoverGroupResources.delete","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.get":"Microsoft.AzureArcData.FailoverGroupResources.get","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.getWithResponse":"Microsoft.AzureArcData.FailoverGroupResources.get","com.azure.resourcemanager.azurearcdata.fluent.FailoverGroupsClient.list":"Microsoft.AzureArcData.FailoverGroupResources.list","com.azure.resourcemanager.azurearcdata.fluent.OperationsClient":"Microsoft.AzureArcData.Operations","com.azure.resourcemanager.azurearcdata.fluent.OperationsClient.list":"Azure.ResourceManager.Legacy.Operations.list","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient":"Microsoft.AzureArcData.PostgresInstances","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.beginCreate":"Microsoft.AzureArcData.PostgresInstances.create","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.beginDelete":"Microsoft.AzureArcData.PostgresInstances.delete","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.create":"Microsoft.AzureArcData.PostgresInstances.create","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.delete":"Microsoft.AzureArcData.PostgresInstances.delete","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.getByResourceGroup":"Microsoft.AzureArcData.PostgresInstances.get","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.getByResourceGroupWithResponse":"Microsoft.AzureArcData.PostgresInstances.get","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.list":"Microsoft.AzureArcData.PostgresInstances.list","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.listByResourceGroup":"Microsoft.AzureArcData.PostgresInstances.listByResourceGroup","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.update":"Microsoft.AzureArcData.PostgresInstances.update","com.azure.resourcemanager.azurearcdata.fluent.PostgresInstancesClient.updateWithResponse":"Microsoft.AzureArcData.PostgresInstances.update","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient":"Microsoft.AzureArcData.SqlManagedInstances","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.beginCreate":"Microsoft.AzureArcData.SqlManagedInstances.create","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.beginDelete":"Microsoft.AzureArcData.SqlManagedInstances.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.create":"Microsoft.AzureArcData.SqlManagedInstances.create","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.delete":"Microsoft.AzureArcData.SqlManagedInstances.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.getByResourceGroup":"Microsoft.AzureArcData.SqlManagedInstances.get","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.getByResourceGroupWithResponse":"Microsoft.AzureArcData.SqlManagedInstances.get","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.list":"Microsoft.AzureArcData.SqlManagedInstances.list","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.listByResourceGroup":"Microsoft.AzureArcData.SqlManagedInstances.listByResourceGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.update":"Microsoft.AzureArcData.SqlManagedInstances.update","com.azure.resourcemanager.azurearcdata.fluent.SqlManagedInstancesClient.updateWithResponse":"Microsoft.AzureArcData.SqlManagedInstances.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.addDatabases":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.addDatabases","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.addDatabasesWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.addDatabases","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginCreateAvailabilityGroup":"Microsoft.AzureArcData.SqlServerInstances.createAvailabilityGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginCreateDistributedAvailabilityGroup":"Microsoft.AzureArcData.SqlServerInstances.createDistributedAvailabilityGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginCreateManagedInstanceLink":"Microsoft.AzureArcData.SqlServerInstances.createManagedInstanceLink","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginDelete":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginDeleteMiLink":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.deleteMiLink","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginFailoverMiLink":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.failoverMiLink","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.beginUpdate":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.create":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.createAvailabilityGroup":"Microsoft.AzureArcData.SqlServerInstances.createAvailabilityGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.createDistributedAvailabilityGroup":"Microsoft.AzureArcData.SqlServerInstances.createDistributedAvailabilityGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.createManagedInstanceLink":"Microsoft.AzureArcData.SqlServerInstances.createManagedInstanceLink","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.createWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.delete":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.deleteMiLink":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.deleteMiLink","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.detailView":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.detailView","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.detailViewWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.detailView","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.failover":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.failover","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.failoverMiLink":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.failoverMiLink","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.failoverWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.failover","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.forceFailoverAllowDataLoss":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.forceFailoverAllowDataLoss","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.forceFailoverAllowDataLossWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.forceFailoverAllowDataLoss","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.get":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.getWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.list":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.list","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.removeDatabases":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.removeDatabases","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.removeDatabasesWithResponse":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.removeDatabases","com.azure.resourcemanager.azurearcdata.fluent.SqlServerAvailabilityGroupsClient.update":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResources.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.beginDelete":"Microsoft.AzureArcData.SqlServerDatabaseResources.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.beginUpdate":"Microsoft.AzureArcData.SqlServerDatabaseResources.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.create":"Microsoft.AzureArcData.SqlServerDatabaseResources.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.createWithResponse":"Microsoft.AzureArcData.SqlServerDatabaseResources.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.delete":"Microsoft.AzureArcData.SqlServerDatabaseResources.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.get":"Microsoft.AzureArcData.SqlServerDatabaseResources.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.getWithResponse":"Microsoft.AzureArcData.SqlServerDatabaseResources.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.list":"Microsoft.AzureArcData.SqlServerDatabaseResources.list","com.azure.resourcemanager.azurearcdata.fluent.SqlServerDatabasesClient.update":"Microsoft.AzureArcData.SqlServerDatabaseResources.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient":"Microsoft.AzureArcData.SqlServerEsuLicenses","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.create":"Microsoft.AzureArcData.SqlServerEsuLicenses.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.createWithResponse":"Microsoft.AzureArcData.SqlServerEsuLicenses.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.delete":"Microsoft.AzureArcData.SqlServerEsuLicenses.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.deleteWithResponse":"Microsoft.AzureArcData.SqlServerEsuLicenses.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.getByResourceGroup":"Microsoft.AzureArcData.SqlServerEsuLicenses.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.getByResourceGroupWithResponse":"Microsoft.AzureArcData.SqlServerEsuLicenses.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.list":"Microsoft.AzureArcData.SqlServerEsuLicenses.list","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.listByResourceGroup":"Microsoft.AzureArcData.SqlServerEsuLicenses.listByResourceGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.update":"Microsoft.AzureArcData.SqlServerEsuLicenses.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerEsuLicensesClient.updateWithResponse":"Microsoft.AzureArcData.SqlServerEsuLicenses.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient":"Microsoft.AzureArcData.SqlServerInstances","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginCreate":"Microsoft.AzureArcData.SqlServerInstances.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginDelete":"Microsoft.AzureArcData.SqlServerInstances.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginGetJobs":"Microsoft.AzureArcData.SqlServerInstances.getJobs","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginGetMigrationReadinessReport":"Microsoft.AzureArcData.SqlServerInstances.getMigrationReadinessReport","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginGetTargetRecommendationReports":"Microsoft.AzureArcData.SqlServerInstances.getTargetRecommendationReports","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginRunBestPracticeAssessment":"Microsoft.AzureArcData.SqlServerInstances.runBestPracticeAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginRunManagedInstanceLinkAssessment":"Microsoft.AzureArcData.SqlServerInstances.runManagedInstanceLinkAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginRunMigrationReadinessAssessment":"Microsoft.AzureArcData.SqlServerInstances.runMigrationReadinessAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginRunTargetRecommendationJob":"Microsoft.AzureArcData.SqlServerInstances.runTargetRecommendationJob","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.beginUpdate":"Microsoft.AzureArcData.SqlServerInstances.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.create":"Microsoft.AzureArcData.SqlServerInstances.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.delete":"Microsoft.AzureArcData.SqlServerInstances.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getAllAvailabilityGroups":"Microsoft.AzureArcData.SqlServerInstances.getAllAvailabilityGroups","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getBestPracticesAssessment":"Microsoft.AzureArcData.SqlServerInstances.getBestPracticesAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getByResourceGroup":"Microsoft.AzureArcData.SqlServerInstances.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getByResourceGroupWithResponse":"Microsoft.AzureArcData.SqlServerInstances.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getJobs":"Microsoft.AzureArcData.SqlServerInstances.getJobs","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getJobsStatus":"Microsoft.AzureArcData.SqlServerInstances.getJobsStatus","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getJobsStatusWithResponse":"Microsoft.AzureArcData.SqlServerInstances.getJobsStatus","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getMigrationReadinessReport":"Microsoft.AzureArcData.SqlServerInstances.getMigrationReadinessReport","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getTargetRecommendationReports":"Microsoft.AzureArcData.SqlServerInstances.getTargetRecommendationReports","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.getTelemetry":"Microsoft.AzureArcData.SqlServerInstances.getTelemetry","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.list":"Microsoft.AzureArcData.SqlServerInstances.list","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.listByResourceGroup":"Microsoft.AzureArcData.SqlServerInstances.listByResourceGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.postUpgrade":"Microsoft.AzureArcData.SqlServerInstances.postUpgrade","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.postUpgradeWithResponse":"Microsoft.AzureArcData.SqlServerInstances.postUpgrade","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.preUpgrade":"Microsoft.AzureArcData.SqlServerInstances.preUpgrade","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.preUpgradeWithResponse":"Microsoft.AzureArcData.SqlServerInstances.preUpgrade","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runBestPracticeAssessment":"Microsoft.AzureArcData.SqlServerInstances.runBestPracticeAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runBestPracticesAssessment":"Microsoft.AzureArcData.SqlServerInstances.runBestPracticesAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runBestPracticesAssessmentWithResponse":"Microsoft.AzureArcData.SqlServerInstances.runBestPracticesAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runManagedInstanceLinkAssessment":"Microsoft.AzureArcData.SqlServerInstances.runManagedInstanceLinkAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runMigrationAssessment":"Microsoft.AzureArcData.SqlServerInstances.runMigrationAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runMigrationAssessmentWithResponse":"Microsoft.AzureArcData.SqlServerInstances.runMigrationAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runMigrationReadinessAssessment":"Microsoft.AzureArcData.SqlServerInstances.runMigrationReadinessAssessment","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.runTargetRecommendationJob":"Microsoft.AzureArcData.SqlServerInstances.runTargetRecommendationJob","com.azure.resourcemanager.azurearcdata.fluent.SqlServerInstancesClient.update":"Microsoft.AzureArcData.SqlServerInstances.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient":"Microsoft.AzureArcData.SqlServerLicenses","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.create":"Microsoft.AzureArcData.SqlServerLicenses.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.createWithResponse":"Microsoft.AzureArcData.SqlServerLicenses.create","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.delete":"Microsoft.AzureArcData.SqlServerLicenses.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.deleteWithResponse":"Microsoft.AzureArcData.SqlServerLicenses.delete","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.getByResourceGroup":"Microsoft.AzureArcData.SqlServerLicenses.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.getByResourceGroupWithResponse":"Microsoft.AzureArcData.SqlServerLicenses.get","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.list":"Microsoft.AzureArcData.SqlServerLicenses.list","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.listByResourceGroup":"Microsoft.AzureArcData.SqlServerLicenses.listByResourceGroup","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.update":"Microsoft.AzureArcData.SqlServerLicenses.update","com.azure.resourcemanager.azurearcdata.fluent.SqlServerLicensesClient.updateWithResponse":"Microsoft.AzureArcData.SqlServerLicenses.update","com.azure.resourcemanager.azurearcdata.fluent.models.ActiveDirectoryConnectorResourceInner":"Microsoft.AzureArcData.ActiveDirectoryConnectorResource","com.azure.resourcemanager.azurearcdata.fluent.models.DataControllerResourceInner":"Microsoft.AzureArcData.DataControllerResource","com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner":"Microsoft.AzureArcData.FailoverGroupResource","com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner":"Microsoft.AzureArcData.Operation","com.azure.resourcemanager.azurearcdata.fluent.models.PostgresInstanceInner":"Microsoft.AzureArcData.PostgresInstance","com.azure.resourcemanager.azurearcdata.fluent.models.SqlManagedInstanceInner":"Microsoft.AzureArcData.SqlManagedInstance","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResource","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner":"Microsoft.AzureArcData.SqlServerDatabaseResource","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner":"Microsoft.AzureArcData.SqlServerEsuLicense","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner":"Microsoft.AzureArcData.SqlServerInstance","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner":"Microsoft.AzureArcData.SqlServerInstanceJobsResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner":"Microsoft.AzureArcData.SqlServerInstanceJobsStatusResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner":"Microsoft.AzureArcData.SqlServerInstanceManagedInstanceLinkAssessmentResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner":"Microsoft.AzureArcData.SqlServerInstanceMigrationReadinessReportResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner":"Microsoft.AzureArcData.SqlServerInstanceRunBestPracticesAssessmentResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner":"Microsoft.AzureArcData.SqlServerInstanceRunMigrationAssessmentResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner":"Microsoft.AzureArcData.SqlServerInstanceRunMigrationReadinessAssessmentResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner":"Microsoft.AzureArcData.SqlServerInstanceRunTargetRecommendationJobResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner":"Microsoft.AzureArcData.SqlServerInstanceTargetRecommendationReportsResponse","com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner":"Microsoft.AzureArcData.SqlServerLicense","com.azure.resourcemanager.azurearcdata.implementation.AzureArcDataManagementClientBuilder":"Microsoft.AzureArcData","com.azure.resourcemanager.azurearcdata.implementation.models.ActiveDirectoryConnectorListResult":"Microsoft.AzureArcData.ActiveDirectoryConnectorListResult","com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerAvailabilityGroupListResult":"Microsoft.AzureArcData.ArcSqlServerAvailabilityGroupListResult","com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerDatabaseListResult":"Microsoft.AzureArcData.ArcSqlServerDatabaseListResult","com.azure.resourcemanager.azurearcdata.implementation.models.FailoverGroupListResult":"Microsoft.AzureArcData.FailoverGroupListResult","com.azure.resourcemanager.azurearcdata.implementation.models.OperationListResult":"Microsoft.AzureArcData.OperationListResult","com.azure.resourcemanager.azurearcdata.implementation.models.PageOfDataControllerResource":"Microsoft.AzureArcData.PageOfDataControllerResource","com.azure.resourcemanager.azurearcdata.implementation.models.PostgresInstanceListResult":"Microsoft.AzureArcData.PostgresInstanceListResult","com.azure.resourcemanager.azurearcdata.implementation.models.SqlManagedInstanceListResult":"Microsoft.AzureArcData.SqlManagedInstanceListResult","com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerEsuLicenseListResult":"Microsoft.AzureArcData.SqlServerEsuLicenseListResult","com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceBpaResponse":"Microsoft.AzureArcData.SqlServerInstanceBpaResponse","com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceListResult":"Microsoft.AzureArcData.SqlServerInstanceListResult","com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceTelemetryResponse":"Microsoft.AzureArcData.SqlServerInstanceTelemetryResponse","com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerLicenseListResult":"Microsoft.AzureArcData.SqlServerLicenseListResult","com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode":"Microsoft.AzureArcData.AccountProvisioningMode","com.azure.resourcemanager.azurearcdata.models.ActivationState":"Microsoft.AzureArcData.ActivationState","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDNSDetails":"Microsoft.AzureArcData.ActiveDirectoryConnectorDNSDetails","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails":"Microsoft.AzureArcData.ActiveDirectoryConnectorDomainDetails","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties":"Microsoft.AzureArcData.ActiveDirectoryConnectorProperties","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorSpec":"Microsoft.AzureArcData.ActiveDirectoryConnectorSpec","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorStatus":"Microsoft.AzureArcData.ActiveDirectoryConnectorStatus","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController":"Microsoft.AzureArcData.ActiveDirectoryDomainController","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers":"Microsoft.AzureArcData.ActiveDirectoryDomainControllers","com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryInformation":"Microsoft.AzureArcData.ActiveDirectoryInformation","com.azure.resourcemanager.azurearcdata.models.AdditionalMigrationJobAttributes":"Microsoft.AzureArcData.AdditionalMigrationJobAttributes","com.azure.resourcemanager.azurearcdata.models.AggregationType":"Microsoft.AzureArcData.AggregationType","com.azure.resourcemanager.azurearcdata.models.AlwaysOnRole":"Microsoft.AzureArcData.AlwaysOnRole","com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType":"Microsoft.AzureArcData.ArcSqlManagedInstanceLicenseType","com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupTypeFilter":"Microsoft.AzureArcData.ArcSqlServerAvailabilityGroupTypeFilter","com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode":"Microsoft.AzureArcData.ArcSqlServerAvailabilityMode","com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode":"Microsoft.AzureArcData.ArcSqlServerFailoverMode","com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType":"Microsoft.AzureArcData.ArcSqlServerLicenseType","com.azure.resourcemanager.azurearcdata.models.AssessmentStatus":"Microsoft.AzureArcData.AssessmentStatus","com.azure.resourcemanager.azurearcdata.models.Authentication":"Microsoft.AzureArcData.Authentication","com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference":"Microsoft.AzureArcData.AutomatedBackupPreference","com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure":"Microsoft.AzureArcData.AvailabilityGroupConfigure","com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration":"Microsoft.AzureArcData.AvailabilityGroupCreateUpdateConfiguration","com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration":"Microsoft.AzureArcData.AvailabilityGroupCreateUpdateReplicaConfiguration","com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo":"Microsoft.AzureArcData.AvailabilityGroupInfo","com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters":"Microsoft.AzureArcData.AvailabilityGroupRetrievalFilters","com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState":"Microsoft.AzureArcData.AvailabilityGroupState","com.azure.resourcemanager.azurearcdata.models.AzureManagedInstanceRole":"Microsoft.AzureArcData.AzureManagedInstanceRole","com.azure.resourcemanager.azurearcdata.models.BackgroundJob":"Microsoft.AzureArcData.BackgroundJob","com.azure.resourcemanager.azurearcdata.models.BackupPolicy":"Microsoft.AzureArcData.BackupPolicy","com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation":"Microsoft.AzureArcData.BasicLoginInformation","com.azure.resourcemanager.azurearcdata.models.BestPracticesAssessment":"Microsoft.AzureArcData.BestPracticesAssessment","com.azure.resourcemanager.azurearcdata.models.BillingPlan":"Microsoft.AzureArcData.BillingPlan","com.azure.resourcemanager.azurearcdata.models.ClientConnection":"Microsoft.AzureArcData.ClientConnection","com.azure.resourcemanager.azurearcdata.models.ClusterType":"Microsoft.AzureArcData.ClusterType","com.azure.resourcemanager.azurearcdata.models.CommonSku":"Microsoft.AzureArcData.CommonSku","com.azure.resourcemanager.azurearcdata.models.ConnectionAuth":"Microsoft.AzureArcData.ConnectionAuth","com.azure.resourcemanager.azurearcdata.models.ConnectionStatus":"Microsoft.AzureArcData.ConnectionStatus","com.azure.resourcemanager.azurearcdata.models.CostOptionSelectedValues":"Microsoft.AzureArcData.CostOptionSelectedValues","com.azure.resourcemanager.azurearcdata.models.CostTypeValues":"Microsoft.AzureArcData.CostTypeValues","com.azure.resourcemanager.azurearcdata.models.CronTrigger":"Microsoft.AzureArcData.CronTrigger","com.azure.resourcemanager.azurearcdata.models.DBMEndpoint":"Microsoft.AzureArcData.DBMEndpoint","com.azure.resourcemanager.azurearcdata.models.DataBaseMigration":"Microsoft.AzureArcData.DataBaseMigration","com.azure.resourcemanager.azurearcdata.models.DataBaseMigrationAssessment":"Microsoft.AzureArcData.DataBaseMigrationAssessment","com.azure.resourcemanager.azurearcdata.models.DataControllerProperties":"Microsoft.AzureArcData.DataControllerProperties","com.azure.resourcemanager.azurearcdata.models.DataControllerUpdate":"Microsoft.AzureArcData.DataControllerUpdate","com.azure.resourcemanager.azurearcdata.models.DatabaseAssessmentsItem":"Microsoft.AzureArcData.DatabaseAssessmentsItem","com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode":"Microsoft.AzureArcData.DatabaseCreateMode","com.azure.resourcemanager.azurearcdata.models.DatabaseMigrationJobsItem":"Microsoft.AzureArcData.DatabaseMigrationJobsItem","com.azure.resourcemanager.azurearcdata.models.DatabaseState":"Microsoft.AzureArcData.DatabaseState","com.azure.resourcemanager.azurearcdata.models.Databases":"Microsoft.AzureArcData.databases","com.azure.resourcemanager.azurearcdata.models.DbFailover":"Microsoft.AzureArcData.DbFailover","com.azure.resourcemanager.azurearcdata.models.DefenderStatus":"Microsoft.AzureArcData.DefenderStatus","com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours":"Microsoft.AzureArcData.DifferentialBackupHours","com.azure.resourcemanager.azurearcdata.models.DiscoverySource":"Microsoft.AzureArcData.DiscoverySource","com.azure.resourcemanager.azurearcdata.models.DiskSizes":"Microsoft.AzureArcData.DiskSizes","com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration":"Microsoft.AzureArcData.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration","com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration":"Microsoft.AzureArcData.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration","com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration":"Microsoft.AzureArcData.DistributedAvailabilityGroupCreateUpdateConfiguration","com.azure.resourcemanager.azurearcdata.models.DtcSupport":"Microsoft.AzureArcData.DtcSupport","com.azure.resourcemanager.azurearcdata.models.EditionType":"Microsoft.AzureArcData.EditionType","com.azure.resourcemanager.azurearcdata.models.EncryptionAlgorithm":"Microsoft.AzureArcData.EncryptionAlgorithm","com.azure.resourcemanager.azurearcdata.models.EntraAuthentication":"Microsoft.AzureArcData.EntraAuthentication","com.azure.resourcemanager.azurearcdata.models.ExecutionState":"Microsoft.AzureArcData.ExecutionState","com.azure.resourcemanager.azurearcdata.models.ExtendedLocation":"Microsoft.AzureArcData.ExtendedLocation","com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes":"Microsoft.AzureArcData.ExtendedLocationTypes","com.azure.resourcemanager.azurearcdata.models.FailoverCluster":"Microsoft.AzureArcData.FailoverCluster","com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode":"Microsoft.AzureArcData.FailoverGroupPartnerSyncMode","com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties":"Microsoft.AzureArcData.FailoverGroupProperties","com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec":"Microsoft.AzureArcData.FailoverGroupSpec","com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId":"Microsoft.AzureArcData.FailoverMiLinkResourceId","com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel":"Microsoft.AzureArcData.FailureConditionLevel","com.azure.resourcemanager.azurearcdata.models.HostIPAddressInformation":"Microsoft.AzureArcData.hostIPAddressInformation","com.azure.resourcemanager.azurearcdata.models.HostType":"Microsoft.AzureArcData.HostType","com.azure.resourcemanager.azurearcdata.models.IdentityType":"Microsoft.AzureArcData.IdentityType","com.azure.resourcemanager.azurearcdata.models.ImpactedObjectsInfo":"Microsoft.AzureArcData.ImpactedObjectsInfo","com.azure.resourcemanager.azurearcdata.models.ImpactedObjectsSuitabilitySummary":"Microsoft.AzureArcData.ImpactedObjectsSuitabilitySummary","com.azure.resourcemanager.azurearcdata.models.Infrastructure":"Microsoft.AzureArcData.Infrastructure","com.azure.resourcemanager.azurearcdata.models.InitiatedFrom":"Microsoft.AzureArcData.initiatedFrom","com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole":"Microsoft.AzureArcData.InstanceFailoverGroupRole","com.azure.resourcemanager.azurearcdata.models.JobStatus":"Microsoft.AzureArcData.JobStatus","com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectory":"Microsoft.AzureArcData.K8sActiveDirectory","com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectoryConnector":"Microsoft.AzureArcData.K8sActiveDirectoryConnector","com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings":"Microsoft.AzureArcData.K8sNetworkSettings","com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements":"Microsoft.AzureArcData.K8sResourceRequirements","com.azure.resourcemanager.azurearcdata.models.K8SScheduling":"Microsoft.AzureArcData.K8sScheduling","com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions":"Microsoft.AzureArcData.K8sSchedulingOptions","com.azure.resourcemanager.azurearcdata.models.K8SSecurity":"Microsoft.AzureArcData.K8sSecurity","com.azure.resourcemanager.azurearcdata.models.K8SSettings":"Microsoft.AzureArcData.K8sSettings","com.azure.resourcemanager.azurearcdata.models.K8STransparentDataEncryption":"Microsoft.AzureArcData.k8stransparentDataEncryption","com.azure.resourcemanager.azurearcdata.models.KeytabInformation":"Microsoft.AzureArcData.KeytabInformation","com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus":"Microsoft.AzureArcData.LastExecutionStatus","com.azure.resourcemanager.azurearcdata.models.LicenseCategory":"Microsoft.AzureArcData.LicenseCategory","com.azure.resourcemanager.azurearcdata.models.LogAnalyticsWorkspaceConfig":"Microsoft.AzureArcData.LogAnalyticsWorkspaceConfig","com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration":"Microsoft.AzureArcData.ManagedInstanceLinkCreateUpdateConfiguration","com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory":"Microsoft.AzureArcData.MiLinkAssessmentCategory","com.azure.resourcemanager.azurearcdata.models.MiLinkCreateUpdateConfiguration":"Microsoft.AzureArcData.MiLinkCreateUpdateConfiguration","com.azure.resourcemanager.azurearcdata.models.Migration":"Microsoft.AzureArcData.Migration","com.azure.resourcemanager.azurearcdata.models.MigrationAssessment":"Microsoft.AzureArcData.MigrationAssessment","com.azure.resourcemanager.azurearcdata.models.MigrationAssessmentSettings":"Microsoft.AzureArcData.MigrationAssessmentSettings","com.azure.resourcemanager.azurearcdata.models.MigrationMode":"Microsoft.AzureArcData.MigrationMode","com.azure.resourcemanager.azurearcdata.models.MigrationStatus":"Microsoft.AzureArcData.MigrationStatus","com.azure.resourcemanager.azurearcdata.models.Mode":"Microsoft.AzureArcData.Mode","com.azure.resourcemanager.azurearcdata.models.Monitoring":"Microsoft.AzureArcData.Monitoring","com.azure.resourcemanager.azurearcdata.models.OnPremiseProperty":"Microsoft.AzureArcData.OnPremiseProperty","com.azure.resourcemanager.azurearcdata.models.OperationDisplay":"Microsoft.AzureArcData.OperationDisplay","com.azure.resourcemanager.azurearcdata.models.OperationOrigin":"Microsoft.AzureArcData.OperationOrigin","com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties":"Microsoft.AzureArcData.PostgresInstanceProperties","com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku":"Microsoft.AzureArcData.PostgresInstanceSku","com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSkuTier":null,"com.azure.resourcemanager.azurearcdata.models.PostgresInstanceUpdate":"Microsoft.AzureArcData.PostgresInstanceUpdate","com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections":"Microsoft.AzureArcData.PrimaryAllowConnections","com.azure.resourcemanager.azurearcdata.models.ProvisioningState":"Microsoft.AzureArcData.ProvisioningState","com.azure.resourcemanager.azurearcdata.models.RecommendationStatus":"Microsoft.AzureArcData.RecommendationStatus","com.azure.resourcemanager.azurearcdata.models.RecoveryMode":"Microsoft.AzureArcData.RecoveryMode","com.azure.resourcemanager.azurearcdata.models.ReplicationPartnerType":"Microsoft.AzureArcData.ReplicationPartnerType","com.azure.resourcemanager.azurearcdata.models.ResourceUpdateMode":"Microsoft.AzureArcData.ResourceUpdateMode","com.azure.resourcemanager.azurearcdata.models.Result":"Microsoft.AzureArcData.Result","com.azure.resourcemanager.azurearcdata.models.Role":"Microsoft.AzureArcData.Role","com.azure.resourcemanager.azurearcdata.models.Schedule":"Microsoft.AzureArcData.Schedule","com.azure.resourcemanager.azurearcdata.models.ScopeType":"Microsoft.AzureArcData.ScopeType","com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections":"Microsoft.AzureArcData.SecondaryAllowConnections","com.azure.resourcemanager.azurearcdata.models.SeedingMode":"Microsoft.AzureArcData.SeedingMode","com.azure.resourcemanager.azurearcdata.models.SequencerAction":"Microsoft.AzureArcData.SequencerAction","com.azure.resourcemanager.azurearcdata.models.SequencerState":"Microsoft.AzureArcData.SequencerState","com.azure.resourcemanager.azurearcdata.models.ServerAssessmentsItem":"Microsoft.AzureArcData.ServerAssessmentsItem","com.azure.resourcemanager.azurearcdata.models.ServerAssessmentsPropertiesItemsItem":"Microsoft.AzureArcData.ServerAssessmentsPropertiesItemsItem","com.azure.resourcemanager.azurearcdata.models.ServiceType":"Microsoft.AzureArcData.ServiceType","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResults":"Microsoft.AzureArcData.SkuRecommendationResults","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlDatabase":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlDatabase","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlDatabaseTargetSku":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlDatabaseTargetSku","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlManagedInstance":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlManagedInstance","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlManagedInstanceTargetSku":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlManagedInstanceTargetSku","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachine":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlVirtualMachine","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSku":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlVirtualMachineTargetSku","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize":"Microsoft.AzureArcData.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsMonthlyCost":"Microsoft.AzureArcData.SkuRecommendationResultsMonthlyCost","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsMonthlyCostOptionItem":"Microsoft.AzureArcData.SkuRecommendationResultsMonthlyCostOptionItem","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationSummary":"Microsoft.AzureArcData.SkuRecommendationSummary","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationSummaryTargetSku":"Microsoft.AzureArcData.SkuRecommendationSummaryTargetSku","com.azure.resourcemanager.azurearcdata.models.SkuRecommendationSummaryTargetSkuCategory":"Microsoft.AzureArcData.SkuRecommendationSummaryTargetSkuCategory","com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties":"Microsoft.AzureArcData.SqlAvailabilityGroupDatabaseReplicaResourceProperties","com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem":"Microsoft.AzureArcData.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem","com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties":"Microsoft.AzureArcData.SqlAvailabilityGroupReplicaResourceProperties","com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties":"Microsoft.AzureArcData.SqlAvailabilityGroupStaticIPListenerProperties","com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw":"Microsoft.AzureArcData.SqlManagedInstanceK8sRaw","com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec":"Microsoft.AzureArcData.SqlManagedInstanceK8sSpec","com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties":"Microsoft.AzureArcData.SqlManagedInstanceProperties","com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku":"Microsoft.AzureArcData.SqlManagedInstanceSku","com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier":"Microsoft.AzureArcData.SqlManagedInstanceSkuTier","com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceUpdate":"Microsoft.AzureArcData.SqlManagedInstanceUpdate","com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResourceProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResourcePropertiesDatabases","com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas":"Microsoft.AzureArcData.SqlServerAvailabilityGroupResourcePropertiesReplicas","com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate":"Microsoft.AzureArcData.SqlServerAvailabilityGroupUpdate","com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties":"Microsoft.AzureArcData.SqlServerDatabaseResourceProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation":"Microsoft.AzureArcData.SqlServerDatabaseResourcePropertiesBackupInformation","com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions":"Microsoft.AzureArcData.SqlServerDatabaseResourcePropertiesDatabaseOptions","com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate":"Microsoft.AzureArcData.SqlServerDatabaseUpdate","com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties":"Microsoft.AzureArcData.SqlServerEsuLicenseProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate":"Microsoft.AzureArcData.SqlServerEsuLicenseUpdate","com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties":"Microsoft.AzureArcData.SqlServerEsuLicenseUpdateProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaColumn":"Microsoft.AzureArcData.SqlServerInstanceBpaColumn","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaColumnType":"Microsoft.AzureArcData.SqlServerInstanceBpaColumnType","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaQueryType":"Microsoft.AzureArcData.SqlServerInstanceBpaQueryType","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaReportType":"Microsoft.AzureArcData.SqlServerInstanceBpaReportType","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest":"Microsoft.AzureArcData.SqlServerInstanceBpaRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJob":"Microsoft.AzureArcData.SqlServerInstanceJob","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobStatus":"Microsoft.AzureArcData.SqlServerInstanceJobStatus","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest":"Microsoft.AzureArcData.SqlServerInstanceJobsRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest":"Microsoft.AzureArcData.SqlServerInstanceJobsStatusRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessment":"Microsoft.AzureArcData.SqlServerInstanceManagedInstanceLinkAssessment","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest":"Microsoft.AzureArcData.SqlServerInstanceManagedInstanceLinkAssessmentRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties":"Microsoft.AzureArcData.SqlServerInstanceProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest":"Microsoft.AzureArcData.SqlServerInstanceRunTargetRecommendationJobRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReport":"Microsoft.AzureArcData.SqlServerInstanceTargetRecommendationReport","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSection":"Microsoft.AzureArcData.SqlServerInstanceTargetRecommendationReportSection","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSectionType":"Microsoft.AzureArcData.SqlServerInstanceTargetRecommendationReportSectionType","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest":"Microsoft.AzureArcData.SqlServerInstanceTargetRecommendationReportsRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryColumn":"Microsoft.AzureArcData.SqlServerInstanceTelemetryColumn","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryColumnType":"Microsoft.AzureArcData.SqlServerInstanceTelemetryColumnType","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest":"Microsoft.AzureArcData.SqlServerInstanceTelemetryRequest","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate":"Microsoft.AzureArcData.SqlServerInstanceUpdate","com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdateProperties":"Microsoft.AzureArcData.SqlServerInstanceUpdateProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties":"Microsoft.AzureArcData.SqlServerLicenseProperties","com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate":"Microsoft.AzureArcData.SqlServerLicenseUpdate","com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdateProperties":"Microsoft.AzureArcData.SqlServerLicenseUpdateProperties","com.azure.resourcemanager.azurearcdata.models.SqlVersion":"Microsoft.AzureArcData.SqlVersion","com.azure.resourcemanager.azurearcdata.models.State":"Microsoft.AzureArcData.State","com.azure.resourcemanager.azurearcdata.models.TargetReadiness":"Microsoft.AzureArcData.TargetReadiness","com.azure.resourcemanager.azurearcdata.models.TargetType":"Microsoft.AzureArcData.TargetType","com.azure.resourcemanager.azurearcdata.models.UploadServicePrincipal":"Microsoft.AzureArcData.UploadServicePrincipal","com.azure.resourcemanager.azurearcdata.models.UploadWatermark":"Microsoft.AzureArcData.UploadWatermark","com.azure.resourcemanager.azurearcdata.models.Version":"Microsoft.AzureArcData.Version"},"generatedFiles":["src/main/java/com/azure/resourcemanager/azurearcdata/AzureArcDataManager.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/ActiveDirectoryConnectorsClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/AzureArcDataManagementClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/DataControllersClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/FailoverGroupsClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/PostgresInstancesClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlManagedInstancesClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerAvailabilityGroupsClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerDatabasesClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerEsuLicensesClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerInstancesClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/SqlServerLicensesClient.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/ActiveDirectoryConnectorResourceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/DataControllerResourceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/FailoverGroupResourceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/PostgresInstanceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlManagedInstanceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerAvailabilityGroupResourceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerDatabaseResourceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerEsuLicenseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceJobsStatusResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceMigrationReadinessReportResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunBestPracticesAssessmentResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationAssessmentResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceRunTargetRecommendationJobResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerInstanceTargetRecommendationReportsResponseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/SqlServerLicenseInner.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/azurearcdata/fluent/package-info.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorResourceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ActiveDirectoryConnectorsImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/AzureArcDataManagementClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllerResourceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/DataControllersImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupResourceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/FailoverGroupsImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstanceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/PostgresInstancesImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstanceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlManagedInstancesImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupResourceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerAvailabilityGroupsImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabaseResourceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerDatabasesImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicenseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerEsuLicensesImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceJobsStatusResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceManagedInstanceLinkAssessmentResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceMigrationReadinessReportResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunBestPracticesAssessmentResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationAssessmentResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunMigrationReadinessAssessmentResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceRunTargetRecommendationJobResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstanceTargetRecommendationReportsResponseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerInstancesImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicenseImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesClientImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/SqlServerLicensesImpl.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ActiveDirectoryConnectorListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerAvailabilityGroupListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/ArcSqlServerDatabaseListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/FailoverGroupListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PageOfDataControllerResource.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/PostgresInstanceListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlManagedInstanceListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerEsuLicenseListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceBpaResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerInstanceTelemetryResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/models/SqlServerLicenseListResult.java","src/main/java/com/azure/resourcemanager/azurearcdata/implementation/package-info.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AccountProvisioningMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActivationState.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDNSDetails.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorDomainDetails.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorResource.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorSpec.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectorStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryConnectors.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainController.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryDomainControllers.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ActiveDirectoryInformation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AdditionalMigrationJobAttributes.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AggregationType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AlwaysOnRole.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlManagedInstanceLicenseType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityGroupTypeFilter.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerAvailabilityMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerFailoverMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ArcSqlServerLicenseType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AssessmentStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Authentication.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AutomatedBackupPreference.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupConfigure.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupCreateUpdateReplicaConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupInfo.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupRetrievalFilters.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AvailabilityGroupState.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/AzureManagedInstanceRole.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/BackgroundJob.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/BackupPolicy.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/BasicLoginInformation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/BestPracticesAssessment.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/BillingPlan.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ClientConnection.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ClusterType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/CommonSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionAuth.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ConnectionStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/CostOptionSelectedValues.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/CostTypeValues.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/CronTrigger.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DBMEndpoint.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DataBaseMigrationAssessment.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerResource.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllerUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DataControllers.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseAssessmentsItem.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseCreateMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseMigrationJobsItem.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DatabaseState.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Databases.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DbFailover.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DefenderStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DifferentialBackupHours.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DiscoverySource.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DiskSizes.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DistributedAvailabilityGroupCreateUpdateConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/DtcSupport.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/EditionType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/EncryptionAlgorithm.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/EntraAuthentication.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ExecutionState.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ExtendedLocationTypes.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverCluster.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupPartnerSyncMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupResource.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroupSpec.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverGroups.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailoverMiLinkResourceId.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/FailureConditionLevel.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/HostIPAddressInformation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/HostType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/IdentityType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsInfo.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ImpactedObjectsSuitabilitySummary.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Infrastructure.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/InitiatedFrom.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/InstanceFailoverGroupRole.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/JobStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SActiveDirectoryConnector.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SNetworkSettings.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SResourceRequirements.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SScheduling.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSchedulingOptions.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSecurity.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8SSettings.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/K8STransparentDataEncryption.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/KeytabInformation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/LastExecutionStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/LicenseCategory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/LogAnalyticsWorkspaceConfig.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ManagedInstanceLinkCreateUpdateConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkAssessmentCategory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/MiLinkCreateUpdateConfiguration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Migration.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessment.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationAssessmentSettings.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/MigrationStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Mode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Monitoring.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/OnPremiseProperty.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Operation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/OperationOrigin.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Operations.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstance.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceSkuTier.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstanceUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PostgresInstances.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/PrimaryAllowConnections.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/RecommendationStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/RecoveryMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ReplicationPartnerType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ResourceUpdateMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Result.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Role.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Schedule.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ScopeType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SecondaryAllowConnections.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SeedingMode.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerAction.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SequencerState.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsItem.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ServerAssessmentsPropertiesItemsItem.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/ServiceType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResults.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabase.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstance.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachine.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCost.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationResultsMonthlyCostOptionItem.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummary.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SkuRecommendationSummaryTargetSkuCategory.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupDatabaseReplicaResourceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupReplicaResourceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlAvailabilityGroupStaticIPListenerProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstance.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SRaw.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceK8SSpec.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSku.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceSkuTier.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstanceUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlManagedInstances.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResource.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesDatabases.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupResourcePropertiesReplicas.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroupUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerAvailabilityGroups.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResource.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesBackupInformation.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseResourcePropertiesDatabaseOptions.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabaseUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerDatabases.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicense.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenseUpdateProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerEsuLicenses.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstance.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumn.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaColumnType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaQueryType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaReportType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceBpaRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJob.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobStatus.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceJobsStatusResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessment.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceManagedInstanceLinkAssessmentResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceMigrationReadinessReportResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunBestPracticesAssessmentResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationAssessmentResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunMigrationReadinessAssessmentResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceRunTargetRecommendationJobResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReport.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSection.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportSectionType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTargetRecommendationReportsResponse.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumn.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryColumnType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceTelemetryRequest.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstanceUpdateProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerInstances.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicense.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdate.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenseUpdateProperties.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlServerLicenses.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/SqlVersion.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/State.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetReadiness.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/TargetType.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadServicePrincipal.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/UploadWatermark.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/Version.java","src/main/java/com/azure/resourcemanager/azurearcdata/models/package-info.java","src/main/java/com/azure/resourcemanager/azurearcdata/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json index 466f8b289f4b..920b3cb2bd9e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurearcdata/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.azurearcdata.implementation.DataControllersClientImpl$DataControllersService"],["com.azure.resourcemanager.azurearcdata.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesClientImpl$SqlManagedInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesClientImpl$SqlServerInstancesService"]] \ No newline at end of file +[["com.azure.resourcemanager.azurearcdata.implementation.ActiveDirectoryConnectorsClientImpl$ActiveDirectoryConnectorsService"],["com.azure.resourcemanager.azurearcdata.implementation.DataControllersClientImpl$DataControllersService"],["com.azure.resourcemanager.azurearcdata.implementation.FailoverGroupsClientImpl$FailoverGroupsService"],["com.azure.resourcemanager.azurearcdata.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.azurearcdata.implementation.PostgresInstancesClientImpl$PostgresInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlManagedInstancesClientImpl$SqlManagedInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerAvailabilityGroupsClientImpl$SqlServerAvailabilityGroupsService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerDatabasesClientImpl$SqlServerDatabasesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerEsuLicensesClientImpl$SqlServerEsuLicensesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerInstancesClientImpl$SqlServerInstancesService"],["com.azure.resourcemanager.azurearcdata.implementation.SqlServerLicensesClientImpl$SqlServerLicensesService"]] \ No newline at end of file diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/azure-resourcemanager-azurearcdata.properties b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/azure-resourcemanager-azurearcdata.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/main/resources/azure-resourcemanager-azurearcdata.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java new file mode 100644 index 000000000000..bb09716843d8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsCreateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDNSDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorProperties; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorSpec; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; + +/** + * Samples for ActiveDirectoryConnectors Create. + */ +public final class ActiveDirectoryConnectorsCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateActiveDirectoryConnector.json + */ + /** + * Sample code: Create or update an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAnActiveDirectoryConnectorInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .define("testADConnector") + .withExistingDataController("testrg", "testdataController") + .withProperties(new ActiveDirectoryConnectorProperties().withSpec(new ActiveDirectoryConnectorSpec() + .withActiveDirectory(new ActiveDirectoryConnectorDomainDetails().withRealm("CONTOSO.LOCAL") + .withServiceAccountProvisioning(AccountProvisioningMode.MANUAL) + .withDomainControllers(new ActiveDirectoryDomainControllers() + .withPrimaryDomainController( + new ActiveDirectoryDomainController().withHostname("dc1.contoso.local")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("dc2.contoso.local"), + new ActiveDirectoryDomainController().withHostname("dc3.contoso.local"))))) + .withDns(new ActiveDirectoryConnectorDNSDetails() + .withNameserverIPAddresses(Arrays.asList("11.11.111.111", "22.22.222.222")) + .withReplicas(1L) + .withPreferK8SDnsForPtrLookups(false)))) + .create(); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java new file mode 100644 index 000000000000..e1f831c2fa55 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for ActiveDirectoryConnectors Delete. + */ +public final class ActiveDirectoryConnectorsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteActiveDirectoryConnector.json + */ + /** + * Sample code: Deletes an Active Directory connector instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAnActiveDirectoryConnectorInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .delete("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java new file mode 100644 index 000000000000..0c3815b2f99c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for ActiveDirectoryConnectors Get. + */ +public final class ActiveDirectoryConnectorsGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetActiveDirectoryConnector.json + */ + /** + * Sample code: Retrieves an Active Directory connector resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnActiveDirectoryConnectorResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors() + .getWithResponse("testrg", "testdataController", "testADConnector", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java new file mode 100644 index 000000000000..85fd5f293a2c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for ActiveDirectoryConnectors List. + */ +public final class ActiveDirectoryConnectorsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByDataControllerActiveDirectoryConnector.json + */ + /** + * Sample code: Gets all Active Directory connectors associated with a data controller. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllActiveDirectoryConnectorsAssociatedWithADataController( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.activeDirectoryConnectors().list("testrg", "testdataController", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java index ae1f666d9e8e..566e1751a976 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class DataControllersDeleteSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * DeleteDataController.json + * x-ms-original-file: 2026-03-01-preview/DeleteDataController.json */ /** * Sample code: Delete a dataController. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java index eb968e535ca5..2c7b863dbca9 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersGetByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class DataControllersGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/GetDataController. - * json + * x-ms-original-file: 2026-03-01-preview/GetDataController.json */ /** * Sample code: Get a data controller. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java index e0f466e5ee5d..a9578f5746ad 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class DataControllersListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListByResourceGroupDataController.json + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupDataController.json */ /** * Sample code: Gets all dataControllers in a resource group. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java index 119e24ea8768..3c874f8587b0 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class DataControllersListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListSubscriptionDataController.json + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionDataController.json */ /** * Sample code: Gets all dataControllers in a subscription. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java index 185113fd1ad4..7a0cbee84d10 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPatchDataControllerSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -13,9 +13,7 @@ */ public final class DataControllersPatchDataControllerSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * UpdateDataController.json + * x-ms-original-file: 2026-03-01-preview/UpdateDataController.json */ /** * Sample code: Updates a dataController tags. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java index 8b454972387a..ee9dbd341dd8 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersPutDataControllerSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -16,16 +16,13 @@ import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; -import java.util.UUID; /** * Samples for DataControllers PutDataController. */ public final class DataControllersPutDataControllerSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * CreateOrUpdateDataController.json + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateDataController.json */ /** * Sample code: Create or update a Data Controller. @@ -39,21 +36,24 @@ public final class DataControllersPutDataControllerSamples { .withRegion("northeurope") .withExistingResourceGroup("testrg") .withProperties(new DataControllerProperties().withInfrastructure(Infrastructure.ONPREMISES) - .withOnPremiseProperty( - new OnPremiseProperty().withId(UUID.fromString("12345678-1234-1234-ab12-1a2b3c4d5e6f")) - .withPublicSigningKey("fakeTokenPlaceholder")) + .withOnPremiseProperty(new OnPremiseProperty().withId("12345678-1234-1234-ab12-1a2b3c4d5e6f") + .withPublicSigningKey("fakeTokenPlaceholder")) .withUploadWatermark( new UploadWatermark().withMetrics(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) .withLogs(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z")) .withUsages(OffsetDateTime.parse("2020-01-01T17:18:19.1234567Z"))) .withBasicLoginInformation( new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) - .withLogAnalyticsWorkspaceConfig(new LogAnalyticsWorkspaceConfig() - .withWorkspaceId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withPrimaryKey("fakeTokenPlaceholder")) + .withMetricsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogsDashboardCredential( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withLogAnalyticsWorkspaceConfig( + new LogAnalyticsWorkspaceConfig().withWorkspaceId("00000000-1111-2222-3333-444444444444") + .withPrimaryKey("fakeTokenPlaceholder")) .withUploadServicePrincipal( - new UploadServicePrincipal().withClientId(UUID.fromString("00000000-1111-2222-3333-444444444444")) - .withTenantId(UUID.fromString("00000000-1111-2222-3333-444444444444")) + new UploadServicePrincipal().withClientId("00000000-1111-2222-3333-444444444444") + .withTenantId("00000000-1111-2222-3333-444444444444") .withAuthority("https://login.microsoftonline.com/") .withClientSecret("fakeTokenPlaceholder")) .withClusterId( diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.java new file mode 100644 index 000000000000..8f99910d37c1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FailoverGroups Create. + */ +public final class FailoverGroupsCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateFailoverGroup.json + */ + /** + * Sample code: Create or update a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createOrUpdateAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .define("testFailoverGroupName") + .withExistingSqlManagedInstance("testrg", "testSqlManagedInstance") + .withProperties(new FailoverGroupProperties().withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/partnerMI") + .withSpec(new FailoverGroupSpec().withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.PRIMARY) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java new file mode 100644 index 000000000000..e2f889b2ecd9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for FailoverGroups Delete. + */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteFailoverGroup.json + */ + /** + * Sample code: Deletes a failover group instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAFailoverGroupInstance(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .delete("testrg", "testSqlManagedInstance", "testFailoverGroupName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.java new file mode 100644 index 000000000000..2cdbf3f8730a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for FailoverGroups Get. + */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetFailoverGroup.json + */ + /** + * Sample code: Retrieves a failover group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAFailoverGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups() + .getWithResponse("testrg", "testSqlManagedInstance", "testFailoverGroupName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java new file mode 100644 index 000000000000..a5654399478a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for FailoverGroups List. + */ +public final class FailoverGroupsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListBySqlManagedInstanceFailoverGroup.json + */ + /** + * Sample code: Gets all failover groups associated with a sql managed instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllFailoverGroupsAssociatedWithASqlManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.failoverGroups().list("testrg", "testSqlManagedInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java index f967a5b66bf6..39f0d3997fae 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,8 +9,7 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ListOperation.json + * x-ms-original-file: 2026-03-01-preview/ListOperation.json */ /** * Sample code: Lists all of the available Azure Data Services on Azure Arc API operations. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.java new file mode 100644 index 000000000000..ea1241ea949d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesCreateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; +import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceProperties; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSkuTier; +import java.io.IOException; + +/** + * Samples for PostgresInstances Create. + */ +public final class PostgresInstancesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdatePostgresInstance.json + */ + /** + * Sample code: Create or update a Postgres Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createOrUpdateAPostgresInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) throws IOException { + manager.postgresInstances() + .define("testpostgresInstance") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new PostgresInstanceProperties().withDataControllerId("dataControllerId") + .withAdmin("admin") + .withBasicLoginInformation( + new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withK8SRaw(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"apiVersion\":\"apiVersion\",\"kind\":\"postgresql-12\",\"metadata\":{\"name\":\"pg1\",\"creationTimestamp\":\"2020-08-25T14:55:10Z\",\"generation\":1,\"namespace\":\"test\",\"resourceVersion\":\"527780\",\"selfLink\":\"/apis/arcdata.microsoft.com/v1alpha1/namespaces/test/postgresql-12s/pg1\",\"uid\":\"1111aaaa-ffff-ffff-ffff-99999aaaaaaa\"},\"spec\":{\"backups\":{\"deltaMinutes\":3,\"fullMinutes\":10,\"tiers\":[{\"retention\":{\"maximums\":[\"6\",\"512MB\"],\"minimums\":[\"3\"]},\"storage\":{\"volumeSize\":\"1Gi\"}}]},\"engine\":{\"extensions\":[{\"name\":\"citus\"}]},\"scale\":{\"shards\":3},\"scheduling\":{\"default\":{\"resources\":{\"requests\":{\"memory\":\"256Mi\"}}}},\"service\":{\"type\":\"NodePort\"},\"storage\":{\"data\":{\"className\":\"local-storage\",\"size\":\"5Gi\"},\"logs\":{\"className\":\"local-storage\",\"size\":\"5Gi\"}}},\"status\":{\"externalEndpoint\":null,\"readyPods\":\"4/4\",\"state\":\"Ready\"}}", + Object.class, SerializerEncoding.JSON))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .withSku(new PostgresInstanceSku().withName("default") + .withDev(true) + .withTier(PostgresInstanceSkuTier.HYPERSCALE)) + .create(); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java new file mode 100644 index 000000000000..72ad2555cdb7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for PostgresInstances Delete. + */ +public final class PostgresInstancesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeletePostgresInstance.json + */ + /** + * Sample code: Deletes a PostgresInstances. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().delete("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..d4f1f7b83d52 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for PostgresInstances GetByResourceGroup. + */ +public final class PostgresInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetPostgresInstance.json + */ + /** + * Sample code: Gets a postgres Instances. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAPostgresInstances(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstances", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java new file mode 100644 index 000000000000..a644d1d6cfa1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for PostgresInstances ListByResourceGroup. + */ +public final class PostgresInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupPostgresInstance.json + */ + /** + * Sample code: Gets all postgres Instances in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllPostgresInstancesInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java new file mode 100644 index 000000000000..f561e892a678 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for PostgresInstances List. + */ +public final class PostgresInstancesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionPostgresInstance.json + */ + /** + * Sample code: Gets all Postgres Instance in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllPostgresInstanceInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.postgresInstances().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java new file mode 100644 index 000000000000..4dd6f39cc5eb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.PostgresInstance; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for PostgresInstances Update. + */ +public final class PostgresInstancesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdatePostgresInstance.json + */ + /** + * Sample code: Updates a postgres Instances tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesAPostgresInstancesTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + PostgresInstance resource = manager.postgresInstances() + .getByResourceGroupWithResponse("testrg", "testpostgresInstance", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java index f6a45d51c730..c1d9fda93e95 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesCreateSamples.java @@ -1,21 +1,30 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryInformation; import com.azure.resourcemanager.azurearcdata.models.ArcSqlManagedInstanceLicenseType; import com.azure.resourcemanager.azurearcdata.models.BasicLoginInformation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation; import com.azure.resourcemanager.azurearcdata.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectory; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectoryConnector; +import com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings; import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; +import com.azure.resourcemanager.azurearcdata.models.K8SSecurity; +import com.azure.resourcemanager.azurearcdata.models.K8SSettings; +import com.azure.resourcemanager.azurearcdata.models.K8STransparentDataEncryption; +import com.azure.resourcemanager.azurearcdata.models.KeytabInformation; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSku; import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceSkuTier; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -24,9 +33,7 @@ */ public final class SqlManagedInstancesCreateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * CreateOrUpdateSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlManagedInstance.json */ /** * Sample code: Create or update a SQL Managed Instance. @@ -59,10 +66,30 @@ public final class SqlManagedInstancesCreateSamples { .withAdditionalProperties(mapOf())) .withAdditionalProperties(mapOf())) .withReplicas(1) + .withSecurity(new K8SSecurity() + .withAdminLoginSecret("fakeTokenPlaceholder") + .withServiceCertificateSecret("fakeTokenPlaceholder") + .withActiveDirectory(new K8SActiveDirectory() + .withConnector(new K8SActiveDirectoryConnector().withName("Name of connector") + .withNamespace("Namespace of connector")) + .withAccountName("Account name") + .withKeytabSecret("fakeTokenPlaceholder") + .withEncryptionTypes( + Arrays.asList("Encryption type item1, Encryption type item2,..."))) + .withTransparentDataEncryption( + new K8STransparentDataEncryption().withMode("SystemManaged")) + .withAdditionalProperties(mapOf())) + .withSettings( + new K8SSettings().withNetwork(new K8SNetworkSettings().withForceencryption(0) + .withTlsciphers( + "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384") + .withTlsprotocols("1.2")).withAdditionalProperties(mapOf())) .withAdditionalProperties(mapOf())) .withAdditionalProperties(mapOf("additionalProperty", 1234))) .withBasicLoginInformation( new BasicLoginInformation().withUsername("username").withPassword("fakeTokenPlaceholder")) + .withActiveDirectoryInformation(new ActiveDirectoryInformation() + .withKeytabInformation(new KeytabInformation().withKeytab("fakeTokenPlaceholder"))) .withLicenseType(ArcSqlManagedInstanceLicenseType.LICENSE_INCLUDED) .withClusterId( "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s") diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java index ff191e8d0ce8..51fc1a47a040 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlManagedInstancesDeleteSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * DeleteSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/DeleteSqlManagedInstance.json */ /** * Sample code: Delete a SQL Instance. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java index 68a094cc72ce..6f58a1eec428 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesGetByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlManagedInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * GetSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/GetSqlManagedInstance.json */ /** * Sample code: Updates a SQL Instance tags. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java index b89cea3dddaa..13839bce0f85 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlManagedInstancesListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListByResourceGroupSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a resource group. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java index 3243e196c22f..0ded9024a333 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlManagedInstancesListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListSubscriptionSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlManagedInstance.json */ /** * Sample code: Gets all SQL Instance in a subscription. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java index 8b68b6f1e2d9..f0b250891e8e 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesUpdateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -13,9 +13,7 @@ */ public final class SqlManagedInstancesUpdateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * UpdateSqlManagedInstance.json + * x-ms-original-file: 2026-03-01-preview/UpdateSqlManagedInstance.json */ /** * Sample code: Updates a sql Instance tags. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesSamples.java new file mode 100644 index 000000000000..ed758ffdddbc --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups AddDatabases. + */ +public final class SqlServerAvailabilityGroupsAddDatabasesSamples { + /* + * x-ms-original-file: 2026-03-01-preview/AddDatabasesToAvailabilityGroup.json + */ + /** + * Sample code: add databases to this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + addDatabasesToThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1", "db2", "db3")), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples.java new file mode 100644 index 000000000000..d60665da3a56 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups CreateAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateAvailabilityGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create an availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAnAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createAvailabilityGroup("testrg", "testSqlServer_INST1", new AvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("myNewAg") + .withReplicas(Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/") + .withEndpointName("inst1DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST1.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/") + .withEndpointName("inst2DBMEndpoint") + .withEndpointUrl("TCP://testSqlServer_INST2.testSqlserverDomain:5022") + .withEndpointConnectLogin("NT Server\\MSSSQLSERVER") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(50) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withSessionTimeout(10))) + .withDatabases(Arrays.asList("database1", "database2")) + .withAutomatedBackupPreference(AutomatedBackupPreference.SECONDARY) + .withFailureConditionLevel(FailureConditionLevel.THREE) + .withHealthCheckTimeout(30000) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.NONE) + .withRequiredSynchronizedSecondariesToCommit(0) + .withClusterType(ClusterType.WSFC) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("myNewAgListener") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("192.1.168.5") + .withMask("255.255.255.0"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("10.1.168.5") + .withMask("255.255.255.0"))) + .withPort(1433)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples.java new file mode 100644 index 000000000000..4119d64012eb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; + +/** + * Samples for SqlServerAvailabilityGroups CreateDistributedAvailabilityGroup. + */ +public final class SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateSqlServerDistributedAvailabilityGroup.json + */ + /** + * Sample code: Create a distributed availability group using this server for the primary replica. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createADistributedAvailabilityGroupUsingThisServerForThePrimaryReplica( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createDistributedAvailabilityGroup("testrg", "testSqlServer_INST1", + new DistributedAvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("myNewDag") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/availabilityGroups/testAG1") + .withListenerUrl("TCP://testAG1.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST2/availabilityGroups/testAG2") + .withListenerUrl("TCP://testAG2.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateManagedInstanceLinkSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateManagedInstanceLinkSamples.java new file mode 100644 index 000000000000..15596e3c4b8c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateManagedInstanceLinkSamples.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.MiLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups CreateManagedInstanceLink. + */ +public final class SqlServerAvailabilityGroupsCreateManagedInstanceLinkSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateManagedInstanceLink.json + */ + /** + * Sample code: Create an Managed Instance Link. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAnManagedInstanceLink(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .createManagedInstanceLink("testrg", "testSqlServer_INST1", + new ManagedInstanceLinkCreateUpdateConfiguration() + .withAvailabilityGroup( + new AvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("myNewAg") + .withReplicas(Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration() + .withEndpointUrl("TCP://testSqlServer_INST1.testSqlserverDomain:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL))) + .withDatabases(Arrays.asList("database1"))) + .withDistributedAvailabilityGroup(new DistributedAvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("myNewDag") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlServerInstances/testSqlServer_INST1/availabilityGroups/testAG1") + .withListenerUrl("TCP://testAG1.contoso.com:5022") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("myCert"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.AUTOMATIC))) + .withMiLinkConfiguration( + new MiLinkCreateUpdateConfiguration().withInstanceAvailabilityGroupName("testAG2")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java new file mode 100644 index 000000000000..36fe712c1a4e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Create. + */ +public final class SqlServerAvailabilityGroupsCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Create a Arc Sql Server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + createAArcSqlServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .define("testAG") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServer_INST1") + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withInfo(new AvailabilityGroupInfo().withFailureConditionLevel(3) + .withHealthCheckTimeout(30000) + .withBasicFeatures(false) + .withDtcSupport(false) + .withDbFailover(true) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(0) + .withIsContained(false)) + .withReplicas( + new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue(Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("testSqlServer\\INST1") + .withConfigure(new AvailabilityGroupConfigure() + .withEndpointUrl("TCP://mytest60-0.mytest60-svc:5022") + .withSessionTimeout(10) + .withBackupPriority(50))))) + .withDatabases(new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db1"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("db2"))))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteMiLinkSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteMiLinkSamples.java new file mode 100644 index 000000000000..db5845a89fda --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteMiLinkSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups DeleteMiLink. + */ +public final class SqlServerAvailabilityGroupsDeleteMiLinkSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteMiLink.json + */ + /** + * Sample code: Fail over from an Arc Sql Server availability group to a Managed Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void failOverFromAnArcSqlServerAvailabilityGroupToAManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .deleteMiLink("testrg", "testSqlServer_INST1", "testDAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java new file mode 100644 index 000000000000..47205a4606ed --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups Delete. + */ +public final class SqlServerAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Deletes a availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + deletesAAvailabilityGroupResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .delete("testrg", "testsqlInstanceAvailabilityGroup", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewSamples.java new file mode 100644 index 000000000000..c81bbb28ab7a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups DetailView. + */ +public final class SqlServerAvailabilityGroupsDetailViewSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ViewArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: detail view for a server availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + detailViewForAServerAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .detailViewWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverMiLinkSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverMiLinkSamples.java new file mode 100644 index 000000000000..da6b31e58dee --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverMiLinkSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; + +/** + * Samples for SqlServerAvailabilityGroups FailoverMiLink. + */ +public final class SqlServerAvailabilityGroupsFailoverMiLinkSamples { + /* + * x-ms-original-file: 2026-03-01-preview/failoverMiLink.json + */ + /** + * Sample code: Fail over from an Arc Sql Server availability group to a Managed Instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void failOverFromAnArcSqlServerAvailabilityGroupToAManagedInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .failoverMiLink("testrg", "testSqlServer_INST1", "testDAG", + new FailoverMiLinkResourceId().withManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testcl"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverSamples.java new file mode 100644 index 000000000000..00ec8341a6e7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups Failover. + */ +public final class SqlServerAvailabilityGroupsFailoverSamples { + /* + * x-ms-original-file: 2026-03-01-preview/FailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group manual failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void availabilityGroupManualFailoverToThisServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .failoverWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples.java new file mode 100644 index 000000000000..76a3105baceb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups ForceFailoverAllowDataLoss. + */ +public final class SqlServerAvailabilityGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ForceFailoverArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: availability group force failover to this server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + availabilityGroupForceFailoverToThisServer(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse("testrg", "testSqlServer_INST1", "testAG", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java new file mode 100644 index 000000000000..9696f268a970 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups Get. + */ +public final class SqlServerAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Retrieves an Arc Sql Server availability group resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesAnArcSqlServerAvailabilityGroupResource( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java new file mode 100644 index 000000000000..4a5cb4773b7e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerAvailabilityGroups List. + */ +public final class SqlServerAvailabilityGroupsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups().list("testrg", "testSqlServer_INST1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesSamples.java new file mode 100644 index 000000000000..ad2fe0a6b477 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; + +/** + * Samples for SqlServerAvailabilityGroups RemoveDatabases. + */ +public final class SqlServerAvailabilityGroupsRemoveDatabasesSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RemoveDatabasesFromAvailabilityGroup.json + */ + /** + * Sample code: remove databases from this availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + removeDatabasesFromThisAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse("testrg", "testSqlServer_INST1", "testAG", + new Databases().withValues(Arrays.asList("db1")), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java new file mode 100644 index 000000000000..f8dd816791b0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerAvailabilityGroups Update. + */ +public final class SqlServerAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateArcSqlServerAvailabilityGroup.json + */ + /** + * Sample code: Update an availability group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateAnAvailabilityGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerAvailabilityGroupResource resource = manager.sqlServerAvailabilityGroups() + .getWithResponse("testrg", "testSqlServer_INST1", "testAG", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java new file mode 100644 index 000000000000..2dbf1b56d20b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateSamples.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.AdditionalMigrationJobAttributes; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigration; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseMigrationJobsItem; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Create. + */ +public final class SqlServerDatabasesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateArcSqlServerDatabase.json + */ + /** + * Sample code: Create a Arc Sql Server database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void createAArcSqlServerDatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .define("testdb") + .withRegion("southeastasia") + .withExistingSqlServerInstance("testrg", "testSqlServerInstance") + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("SQL_Latin1_General_CP1_CI_AS") + .withDatabaseCreationDate(OffsetDateTime.parse("2022-04-05T16:26:33.883Z")) + .withCompatibilityLevel(150) + .withSizeMB(150.0D) + .withLogFileSizeMB(70.0D) + .withDataFileSizeMB(80.0D) + .withSpaceAvailableMB(100.0D) + .withState(DatabaseState.ONLINE) + .withIsReadOnly(true) + .withRecoveryMode(RecoveryMode.FULL) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(true) + .withIsAutoShrinkOn(true) + .withIsAutoCreateStatsOn(true) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(true) + .withIsMemoryOptimizationEnabled(true) + .withIsEncrypted(true) + .withIsTrustworthyOn(true) + .withIsHekatonFilesOn(false)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withLastLogBackup(OffsetDateTime.parse("2022-05-10T16:26:33.883Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.TWELVE) + .withTransactionLogBackupMinutes(30)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/testSqlServerInstance/testsqlManagedInstance/databases/MyDatabase") + .withRestorePointInTime(OffsetDateTime.parse("2022-05-05T16:26:33.883Z")) + .withMigration(new DataBaseMigration().withJobs(Arrays.asList(new DatabaseMigrationJobsItem() + .withMigrationTrackingId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/SqlMigrationServices/my-migration-service") + .withMigrationMode(MigrationMode.LOG_SHIPPING) + .withInitiatedFrom(InitiatedFrom.DMSPORTAL) + .withTargetType(TargetType.AZURE_SQL_MANAGED_INSTANCE) + .withTargetResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Sql/managedInstances/myManagedInstance/databases/myDatabase") + .withAdditionalAttributes( + Arrays.asList(new AdditionalMigrationJobAttributes().withKeyName("fakeTokenPlaceholder") + .withKeyValue("fakeTokenPlaceholder"))))))) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java new file mode 100644 index 000000000000..9d8eb398b5f6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerDatabases Delete. + */ +public final class SqlServerDatabasesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteArcSqlServerDatabase.json + */ + /** + * Sample code: Deletes a database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deletesADatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .delete("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java new file mode 100644 index 000000000000..83bf7114dc74 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerDatabases Get. + */ +public final class SqlServerDatabasesGetSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetArcSqlServerDatabase.json + */ + /** + * Sample code: Retrieves an Arc Sql Server database resource. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesAnArcSqlServerDatabaseResource(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases() + .getWithResponse("testrg", "testSqlServerInstance", "testdb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java new file mode 100644 index 000000000000..0faed9cbfd2e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerDatabases List. + */ +public final class SqlServerDatabasesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListBySqlServerInstanceDatabase.json + */ + /** + * Sample code: Gets all databases associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllDatabasesAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerDatabases().list("testrg", "testSqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java new file mode 100644 index 000000000000..98c4aeaf140e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerDatabases Update. + */ +public final class SqlServerDatabasesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerDatabase.json + */ + /** + * Sample code: Update a database. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updateADatabase(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerDatabaseResource resource = manager.sqlServerDatabases() + .getWithResponse("testrg", "testsqlManagedInstance", "testdb", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval1")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateSamples.java new file mode 100644 index 000000000000..50ad4a262ed3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Create. + */ +public final class SqlServerEsuLicensesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Updates a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void updatesASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .define("testsqlServerEsuLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withVersion(Version.SQLSERVER2016) + .withPhysicalCores(24) + .withActivationState(State.INACTIVE) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteSamples.java new file mode 100644 index 000000000000..2c96fa9346c4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses Delete. + */ +public final class SqlServerEsuLicensesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteSqlServerEsuLicense.json + */ + /** + * Sample code: Delete a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..400edbbdc7fb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses GetByResourceGroup. + */ +public final class SqlServerEsuLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerEsuLicense.json + */ + /** + * Sample code: Gets a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupSamples.java new file mode 100644 index 000000000000..f57b2c368851 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses ListByResourceGroup. + */ +public final class SqlServerEsuLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllSQLServerESULicensesInAResourceGroup( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListSamples.java new file mode 100644 index 000000000000..cfa127f0e70b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerEsuLicenses List. + */ +public final class SqlServerEsuLicensesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlServerEsuLicense.json + */ + /** + * Sample code: Gets all SQL Server ESU licenses in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerESULicensesInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerEsuLicenses().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesUpdateSamples.java new file mode 100644 index 000000000000..40a68df72a57 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesUpdateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerEsuLicenses Update. + */ +public final class SqlServerEsuLicensesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerEsuLicense.json + */ + /** + * Sample code: Patch a SQL Server ESU license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerESULicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerEsuLicense resource = manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerEsuLicense", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("mytag", "myval")) + .withProperties(new SqlServerEsuLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(28) + .withActivationState(State.ACTIVE)) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java index cf6a8bf073f6..14e6f4634374 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateSamples.java @@ -1,16 +1,29 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; +import com.azure.resourcemanager.azurearcdata.models.Authentication; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.BestPracticesAssessment; +import com.azure.resourcemanager.azurearcdata.models.ClientConnection; +import com.azure.resourcemanager.azurearcdata.models.CronTrigger; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.DiscoverySource; import com.azure.resourcemanager.azurearcdata.models.EditionType; +import com.azure.resourcemanager.azurearcdata.models.EntraAuthentication; +import com.azure.resourcemanager.azurearcdata.models.HostType; +import com.azure.resourcemanager.azurearcdata.models.IdentityType; +import com.azure.resourcemanager.azurearcdata.models.Migration; +import com.azure.resourcemanager.azurearcdata.models.MigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.Mode; +import com.azure.resourcemanager.azurearcdata.models.Monitoring; +import com.azure.resourcemanager.azurearcdata.models.Schedule; +import com.azure.resourcemanager.azurearcdata.models.ServiceType; import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -19,9 +32,7 @@ */ public final class SqlServerInstancesCreateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * CreateOrUpdateSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. @@ -35,21 +46,29 @@ public final class SqlServerInstancesCreateSamples { .withRegion("northeurope") .withExistingResourceGroup("testrg") .withTags(mapOf("mytag", "myval")) - .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2017) + .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQLSERVER2012) .withEdition(EditionType.DEVELOPER) - .withContainerResourceId("Arc Machine Name") - .withVCore("4") - .withStatus(ConnectionStatus.CONNECTED) - .withPatchLevel("patchlevel") - .withCollation("collation") - .withCurrentVersion("2008 R2") + .withCores("4") + .withDiscoverySource(DiscoverySource.SSMS) .withInstanceName("name of instance") - .withTcpDynamicPorts("1433") - .withTcpStaticPorts("1433") - .withProductId("sql id") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2020-01-02T17:18:19.1234567Z")) - .withAzureDefenderStatus(DefenderStatus.PROTECTED)) + .withHostType(HostType.PHYSICAL_SERVER) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1) + .withFullBackupDays(1) + .withDifferentialBackupHours(DifferentialBackupHours.TWELVE) + .withTransactionLogBackupMinutes(30)) + .withMonitoring(new Monitoring().withEnabled(false)) + .withMigration(new Migration().withAssessment(new MigrationAssessment().withEnabled(false))) + .withBestPracticesAssessment(new BestPracticesAssessment().withEnabled(true) + .withSchedule(new Schedule().withEnabled(true) + .withCronTrigger(new CronTrigger().withExpression("0 0 12 1 11")))) + .withClientConnection(new ClientConnection().withEnabled(false)) + .withServiceType(ServiceType.ENGINE) + .withAuthentication(new Authentication().withMode(Mode.WINDOWS) + .withSqlServerEntraIdentity(Arrays.asList( + new EntraAuthentication().withIdentityType(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY) + .withClientId("00000000-1111-2222-3333-444444444444"), + new EntraAuthentication().withIdentityType(IdentityType.SYSTEM_ASSIGNED_MANAGED_IDENTITY) + .withClientId(""))))) .create(); } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java index 6cdd52ec5d80..7a1927b7f3b5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlServerInstancesDeleteSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * DeleteSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/DeleteSqlServerInstance.json */ /** * Sample code: Delete a SQL Server Instance. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetAllAvailabilityGroupsSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetAllAvailabilityGroupsSamples.java new file mode 100644 index 000000000000..77e8f55c37e6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetAllAvailabilityGroupsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupTypeFilter; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.ReplicationPartnerType; + +/** + * Samples for SqlServerInstances GetAllAvailabilityGroups. + */ +public final class SqlServerInstancesGetAllAvailabilityGroupsSamples { + /* + * x-ms-original-file: 2026-03-01-preview/FilteredListBySqlServerInstanceAvailabilityGroup.json + */ + /** + * Sample code: Gets all availability groups associated with an Arc Enabled Sql server. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsAllAvailabilityGroupsAssociatedWithAnArcEnabledSqlServer( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getAllAvailabilityGroups("exampleResourceGroup", "exampleSqlServerInstance", + new AvailabilityGroupRetrievalFilters() + .withAvailabilityGroupTypeFilter(ArcSqlServerAvailabilityGroupTypeFilter.DISTRIBUTED) + .withReplicationPartnerTypeFilter(ReplicationPartnerType.AZURE_SQLMANAGED_INSTANCE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetBestPracticesAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetBestPracticesAssessmentSamples.java new file mode 100644 index 000000000000..1679387b90d8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetBestPracticesAssessmentSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaQueryType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaReportType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaRequest; + +/** + * Samples for SqlServerInstances GetBestPracticesAssessment. + */ +public final class SqlServerInstancesGetBestPracticesAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceBpa.json + */ + /** + * Sample code: Retrieves Arc SQL Server best practices assessment results. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerBestPracticesAssessmentResults( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getBestPracticesAssessment("testrg", "testsqlserver", + new SqlServerInstanceBpaRequest().withReportType(SqlServerInstanceBpaReportType.ASSESSMENT_SUMMARY) + .withReportId("ad43a05f-efed-448a-ae53-5e4abd29068f") + .withQueryType(SqlServerInstanceBpaQueryType.BASIC), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java index b485bf4e5a2c..939d1ff6d7c6 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlServerInstancesGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * GetSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsSamples.java new file mode 100644 index 000000000000..9316803dd655 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; + +/** + * Samples for SqlServerInstances GetJobs. + */ +public final class SqlServerInstancesGetJobsSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceJobs.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance jobs status. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesArcSQLServerInstanceJobsStatus(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getJobs("testrg", "testsqlserver", + new SqlServerInstanceJobsRequest().withFeatureName("MigrationAssessment").withJobType("Ondemand"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusSamples.java new file mode 100644 index 000000000000..d343197a42a8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; + +/** + * Samples for SqlServerInstances GetJobsStatus. + */ +public final class SqlServerInstancesGetJobsStatusSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceJobsStatus.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance jobs status. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + retrievesArcSQLServerInstanceJobsStatus(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getJobsStatusWithResponse("testrg", "testsqlserver", + new SqlServerInstanceJobsStatusRequest().withFeatureName("MigrationAssessment").withJobType("Ondemand"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetMigrationReadinessReportSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetMigrationReadinessReportSamples.java new file mode 100644 index 000000000000..4f31526b62f6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetMigrationReadinessReportSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances GetMigrationReadinessReport. + */ +public final class SqlServerInstancesGetMigrationReadinessReportSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceMigrationReadinessReport.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance migration readiness report. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceMigrationReadinessReport( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getMigrationReadinessReport("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTargetRecommendationReportsSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTargetRecommendationReportsSamples.java new file mode 100644 index 000000000000..670688535034 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTargetRecommendationReportsSamples.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSectionType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import java.util.Arrays; + +/** + * Samples for SqlServerInstances GetTargetRecommendationReports. + */ +public final class SqlServerInstancesGetTargetRecommendationReportsSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTargetRecommendationReportsWithFilters.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance target recommendation reports with filters. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceTargetRecommendationReportsWithFilters( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTargetRecommendationReports("testrg", "testsqlserver", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(0) + .withSectionOffset(0) + .withSectionType( + SqlServerInstanceTargetRecommendationReportSectionType.SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE) + .withDatabaseNames(Arrays.asList("database1", "database2")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTargetRecommendationReports.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance target recommendation reports. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceTargetRecommendationReports( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTargetRecommendationReports("testrg", "testsqlserver", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(0).withSectionOffset(0), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTargetRecommendationReportsLastPage.json + */ + /** + * Sample code: Retrieves Arc SQL Server instance target recommendation reports - last page. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerInstanceTargetRecommendationReportsLastPage( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTargetRecommendationReports("testrg", "testsqlserver", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(0).withSectionOffset(9), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTelemetrySamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTelemetrySamples.java new file mode 100644 index 000000000000..b37bc6dd8ba7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTelemetrySamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; +import java.time.OffsetDateTime; + +/** + * Samples for SqlServerInstances GetTelemetry. + */ +public final class SqlServerInstancesGetTelemetrySamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerInstanceTelemetry.json + */ + /** + * Sample code: Retrieves Arc SQL Server cpu utilization telemetry. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void retrievesArcSQLServerCpuUtilizationTelemetry( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .getTelemetry("testrg", "testsqlserver", + new SqlServerInstanceTelemetryRequest().withDatasetName("sqlserver_storage_io") + .withStartTime(OffsetDateTime.parse("2023-09-30T00:00:00Z")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java index 67f78ab8f776..842716a443b9 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlServerInstancesListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListByResourceGroupSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a resource group. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java index 679fc9d83c11..8f0e0e58ee87 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -9,9 +9,7 @@ */ public final class SqlServerInstancesListSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * ListSubscriptionSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlServerInstance.json */ /** * Sample code: Gets all SQL Server Instance in a subscription. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPostUpgradeSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPostUpgradeSamples.java new file mode 100644 index 000000000000..42b40001577f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPostUpgradeSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances PostUpgrade. + */ +public final class SqlServerInstancesPostUpgradeSamples { + /* + * x-ms-original-file: 2026-03-01-preview/PostUpgradeSqlServerInstance.json + */ + /** + * Sample code: Post AUM Upgrade to complete SQL Instance Upgrade Process. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void postAUMUpgradeToCompleteSQLInstanceUpgradeProcess( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .postUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPreUpgradeSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPreUpgradeSamples.java new file mode 100644 index 000000000000..dcfe3a12ab3d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesPreUpgradeSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances PreUpgrade. + */ +public final class SqlServerInstancesPreUpgradeSamples { + /* + * x-ms-original-file: 2026-03-01-preview/PreUpgradeSqlServerInstance.json + */ + /** + * Sample code: Prepare SQL server instance for AUM Upgrade. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + prepareSQLServerInstanceForAUMUpgrade(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .preUpgradeWithResponse("testrg", "testsqlServerInstance", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticeAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticeAssessmentSamples.java new file mode 100644 index 000000000000..abed0172d701 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticeAssessmentSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances RunBestPracticeAssessment. + */ +public final class SqlServerInstancesRunBestPracticeAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunBestPracticeAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger best practices assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerBestPracticesAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runBestPracticeAssessment("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticesAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticesAssessmentSamples.java new file mode 100644 index 000000000000..821b8ab3e180 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticesAssessmentSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances RunBestPracticesAssessment. + */ +public final class SqlServerInstancesRunBestPracticesAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunBestPracticesAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger best practices assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerBestPracticesAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runBestPracticesAssessmentWithResponse("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunManagedInstanceLinkAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunManagedInstanceLinkAssessmentSamples.java new file mode 100644 index 000000000000..23eff06071f1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunManagedInstanceLinkAssessmentSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.AzureManagedInstanceRole; +import com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import java.util.Arrays; + +/** + * Samples for SqlServerInstances RunManagedInstanceLinkAssessment. + */ +public final class SqlServerInstancesRunManagedInstanceLinkAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunManagedInstanceLinkAssessment.json + */ + /** + * Sample code: Runs Managed Instance Link Assessments and retrieves the results. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void runsManagedInstanceLinkAssessmentsAndRetrievesTheResults( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runManagedInstanceLinkAssessment("testrg", "testsqlserver", + new SqlServerInstanceManagedInstanceLinkAssessmentRequest().withAzureManagedInstanceResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testmi") + .withAzureManagedInstanceRole(AzureManagedInstanceRole.SECONDARY) + .withDatabaseNames(Arrays.asList("testdb", "testdb2", "testdb3")) + .withAvailabilityGroupName("AG_testdb") + .withDistributedAvailabilityGroupName("MiLinkDag") + .withAssessmentCategories( + Arrays.asList(MiLinkAssessmentCategory.SQL_INSTANCE, MiLinkAssessmentCategory.MANAGED_INSTANCE, + MiLinkAssessmentCategory.MANAGED_INSTANCE_CROSS_VALIDATION, + MiLinkAssessmentCategory.DAG_CROSS_VALIDATION)) + .withSqlServerIpAddress("192.168.1.2"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentSamples.java new file mode 100644 index 000000000000..9b94db53cb63 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances RunMigrationAssessment. + */ +public final class SqlServerInstancesRunMigrationAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunMigrationAssessmentSqlServerInstance.json + */ + /** + * Sample code: Trigger migration assessment run on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerMigrationAssessmentRunOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runMigrationAssessmentWithResponse("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationReadinessAssessmentSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationReadinessAssessmentSamples.java new file mode 100644 index 000000000000..0279d9920655 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationReadinessAssessmentSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerInstances RunMigrationReadinessAssessment. + */ +public final class SqlServerInstancesRunMigrationReadinessAssessmentSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunMigrationReadinessAssessmentSqlServerInstance.json + */ + /** + * Sample code: Run migration readiness assessment on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void runMigrationReadinessAssessmentOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runMigrationReadinessAssessment("testrg", "testsqlserver", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunTargetRecommendationJobSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunTargetRecommendationJobSamples.java new file mode 100644 index 000000000000..a48e998fa260 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunTargetRecommendationJobSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ResourceUpdateMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; + +/** + * Samples for SqlServerInstances RunTargetRecommendationJob. + */ +public final class SqlServerInstancesRunTargetRecommendationJobSamples { + /* + * x-ms-original-file: 2026-03-01-preview/RunTargetRecommendationJobSqlServerInstance.json + */ + /** + * Sample code: Trigger target recommendation job on sql server instance. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void triggerTargetRecommendationJobOnSqlServerInstance( + com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerInstances() + .runTargetRecommendationJob("testrg", "testsqlserver", + new SqlServerInstanceRunTargetRecommendationJobRequest() + .withResourceUpdateMode(ResourceUpdateMode.UPDATE_ALL_TARGET_RECOMMENDATION_DETAILS) + .withIncludeFileLevelRequirements(false) + .withTargetLocation("westus") + .withPercentile(95) + .withLookbackPeriodInDays(30), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java index e6286caa75ed..7935c61d1eab 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesUpdateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -13,9 +13,7 @@ */ public final class SqlServerInstancesUpdateSamples { /* - * x-ms-original-file: - * specification/azurearcdata/resource-manager/Microsoft.AzureArcData/stable/2021-08-01/examples/ - * UpdateSqlServerInstance.json + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerInstance.json */ /** * Sample code: Updates a SQL Server Instance tags. diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateSamples.java new file mode 100644 index 000000000000..3d7668fa376b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Create. + */ +public final class SqlServerLicensesCreateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSqlServerLicense.json + */ + /** + * Sample code: Updates a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + updatesASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .define("testsqlServerLicense") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withProperties(new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withPhysicalCores(24) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("mytag", "myval")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteSamples.java new file mode 100644 index 000000000000..f7800cd26468 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses Delete. + */ +public final class SqlServerLicensesDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/DeleteSqlServerLicense.json + */ + /** + * Sample code: Delete a SQL Server license. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void deleteASQLServerLicense(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .deleteByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..9118c72a8364 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses GetByResourceGroup. + */ +public final class SqlServerLicensesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/GetSqlServerLicense.json + */ + /** + * Sample code: Gets a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void getsASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupSamples.java new file mode 100644 index 000000000000..2133f440ee1e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses ListByResourceGroup. + */ +public final class SqlServerLicensesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListByResourceGroupSqlServerLicense.json + */ + /** + * Sample code: Gets all SQL Server license in a resource group. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerLicenseInAResourceGroup(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListSamples.java new file mode 100644 index 000000000000..e649c3d52220 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +/** + * Samples for SqlServerLicenses List. + */ +public final class SqlServerLicensesListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/ListSubscriptionSqlServerLicense.json + */ + /** + * Sample code: Gets all SQL Server license in a subscription. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void + getsAllSQLServerLicenseInASubscription(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + manager.sqlServerLicenses().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesUpdateSamples.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesUpdateSamples.java new file mode 100644 index 000000000000..80e5c75bd08b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/samples/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SqlServerLicenses Update. + */ +public final class SqlServerLicensesUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/UpdateSqlServerLicense.json + */ + /** + * Sample code: Patch a SQL Server license tags. + * + * @param manager Entry point to AzureArcDataManager. + */ + public static void patchASQLServerLicenseTags(com.azure.resourcemanager.azurearcdata.AzureArcDataManager manager) { + SqlServerLicense resource = manager.sqlServerLicenses() + .getByResourceGroupWithResponse("testrg", "testsqlServerLicense", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorDNSDetailsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorDNSDetailsTests.java new file mode 100644 index 000000000000..4c5473d2dab8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorDNSDetailsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDNSDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ActiveDirectoryConnectorDNSDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActiveDirectoryConnectorDNSDetails model = BinaryData.fromString( + "{\"domainName\":\"cjimryvwgcwwpbmz\",\"nameserverIPAddresses\":[\"esyds\"],\"replicas\":4091952477232299977,\"preferK8sDnsForPtrLookups\":true}") + .toObject(ActiveDirectoryConnectorDNSDetails.class); + Assertions.assertEquals("cjimryvwgcwwpbmz", model.domainName()); + Assertions.assertEquals("esyds", model.nameserverIPAddresses().get(0)); + Assertions.assertEquals(4091952477232299977L, model.replicas()); + Assertions.assertTrue(model.preferK8SDnsForPtrLookups()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActiveDirectoryConnectorDNSDetails model + = new ActiveDirectoryConnectorDNSDetails().withDomainName("cjimryvwgcwwpbmz") + .withNameserverIPAddresses(Arrays.asList("esyds")) + .withReplicas(4091952477232299977L) + .withPreferK8SDnsForPtrLookups(true); + model = BinaryData.fromObject(model).toObject(ActiveDirectoryConnectorDNSDetails.class); + Assertions.assertEquals("cjimryvwgcwwpbmz", model.domainName()); + Assertions.assertEquals("esyds", model.nameserverIPAddresses().get(0)); + Assertions.assertEquals(4091952477232299977L, model.replicas()); + Assertions.assertTrue(model.preferK8SDnsForPtrLookups()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorDomainDetailsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorDomainDetailsTests.java new file mode 100644 index 000000000000..05b556c5c4b6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorDomainDetailsTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ActiveDirectoryConnectorDomainDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActiveDirectoryConnectorDomainDetails model = BinaryData.fromString( + "{\"realm\":\"fdmmcpug\",\"netbiosDomainName\":\"hqepvufhbzehewh\",\"serviceAccountProvisioning\":\"automatic\",\"ouDistinguishedName\":\"lbqnbldxeacl\",\"domainControllers\":{\"primaryDomainController\":{\"hostname\":\"horimkr\"},\"secondaryDomainControllers\":[{\"hostname\":\"moucsofldpuviyfc\"},{\"hostname\":\"abeolhbhlvbm\"},{\"hostname\":\"uqibsxtkcu\"}]}}") + .toObject(ActiveDirectoryConnectorDomainDetails.class); + Assertions.assertEquals("fdmmcpug", model.realm()); + Assertions.assertEquals("hqepvufhbzehewh", model.netbiosDomainName()); + Assertions.assertEquals(AccountProvisioningMode.AUTOMATIC, model.serviceAccountProvisioning()); + Assertions.assertEquals("lbqnbldxeacl", model.ouDistinguishedName()); + Assertions.assertEquals("horimkr", model.domainControllers().primaryDomainController().hostname()); + Assertions.assertEquals("moucsofldpuviyfc", + model.domainControllers().secondaryDomainControllers().get(0).hostname()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActiveDirectoryConnectorDomainDetails model = new ActiveDirectoryConnectorDomainDetails().withRealm("fdmmcpug") + .withNetbiosDomainName("hqepvufhbzehewh") + .withServiceAccountProvisioning(AccountProvisioningMode.AUTOMATIC) + .withOuDistinguishedName("lbqnbldxeacl") + .withDomainControllers(new ActiveDirectoryDomainControllers() + .withPrimaryDomainController(new ActiveDirectoryDomainController().withHostname("horimkr")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("moucsofldpuviyfc"), + new ActiveDirectoryDomainController().withHostname("abeolhbhlvbm"), + new ActiveDirectoryDomainController().withHostname("uqibsxtkcu")))); + model = BinaryData.fromObject(model).toObject(ActiveDirectoryConnectorDomainDetails.class); + Assertions.assertEquals("fdmmcpug", model.realm()); + Assertions.assertEquals("hqepvufhbzehewh", model.netbiosDomainName()); + Assertions.assertEquals(AccountProvisioningMode.AUTOMATIC, model.serviceAccountProvisioning()); + Assertions.assertEquals("lbqnbldxeacl", model.ouDistinguishedName()); + Assertions.assertEquals("horimkr", model.domainControllers().primaryDomainController().hostname()); + Assertions.assertEquals("moucsofldpuviyfc", + model.domainControllers().secondaryDomainControllers().get(0).hostname()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorSpecTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorSpecTests.java new file mode 100644 index 000000000000..976e5ee66bc8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorSpecTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AccountProvisioningMode; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDNSDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorDomainDetails; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorSpec; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ActiveDirectoryConnectorSpecTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActiveDirectoryConnectorSpec model = BinaryData.fromString( + "{\"activeDirectory\":{\"realm\":\"bwwg\",\"netbiosDomainName\":\"vibidmhmwffpl\",\"serviceAccountProvisioning\":\"automatic\",\"ouDistinguishedName\":\"apckccrrvw\",\"domainControllers\":{\"primaryDomainController\":{\"hostname\":\"xoy\"},\"secondaryDomainControllers\":[{\"hostname\":\"phaimmoi\"}]}},\"dns\":{\"domainName\":\"qboshbra\",\"nameserverIPAddresses\":[\"pyyrmfs\",\"bpav\",\"opfppdbwnupgah\",\"kuma\"],\"replicas\":4610339320478371980,\"preferK8sDnsForPtrLookups\":true}}") + .toObject(ActiveDirectoryConnectorSpec.class); + Assertions.assertEquals("bwwg", model.activeDirectory().realm()); + Assertions.assertEquals("vibidmhmwffpl", model.activeDirectory().netbiosDomainName()); + Assertions.assertEquals(AccountProvisioningMode.AUTOMATIC, + model.activeDirectory().serviceAccountProvisioning()); + Assertions.assertEquals("apckccrrvw", model.activeDirectory().ouDistinguishedName()); + Assertions.assertEquals("xoy", + model.activeDirectory().domainControllers().primaryDomainController().hostname()); + Assertions.assertEquals("phaimmoi", + model.activeDirectory().domainControllers().secondaryDomainControllers().get(0).hostname()); + Assertions.assertEquals("qboshbra", model.dns().domainName()); + Assertions.assertEquals("pyyrmfs", model.dns().nameserverIPAddresses().get(0)); + Assertions.assertEquals(4610339320478371980L, model.dns().replicas()); + Assertions.assertTrue(model.dns().preferK8SDnsForPtrLookups()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActiveDirectoryConnectorSpec model = new ActiveDirectoryConnectorSpec() + .withActiveDirectory(new ActiveDirectoryConnectorDomainDetails().withRealm("bwwg") + .withNetbiosDomainName("vibidmhmwffpl") + .withServiceAccountProvisioning(AccountProvisioningMode.AUTOMATIC) + .withOuDistinguishedName("apckccrrvw") + .withDomainControllers(new ActiveDirectoryDomainControllers() + .withPrimaryDomainController(new ActiveDirectoryDomainController().withHostname("xoy")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("phaimmoi"))))) + .withDns(new ActiveDirectoryConnectorDNSDetails().withDomainName("qboshbra") + .withNameserverIPAddresses(Arrays.asList("pyyrmfs", "bpav", "opfppdbwnupgah", "kuma")) + .withReplicas(4610339320478371980L) + .withPreferK8SDnsForPtrLookups(true)); + model = BinaryData.fromObject(model).toObject(ActiveDirectoryConnectorSpec.class); + Assertions.assertEquals("bwwg", model.activeDirectory().realm()); + Assertions.assertEquals("vibidmhmwffpl", model.activeDirectory().netbiosDomainName()); + Assertions.assertEquals(AccountProvisioningMode.AUTOMATIC, + model.activeDirectory().serviceAccountProvisioning()); + Assertions.assertEquals("apckccrrvw", model.activeDirectory().ouDistinguishedName()); + Assertions.assertEquals("xoy", + model.activeDirectory().domainControllers().primaryDomainController().hostname()); + Assertions.assertEquals("phaimmoi", + model.activeDirectory().domainControllers().secondaryDomainControllers().get(0).hostname()); + Assertions.assertEquals("qboshbra", model.dns().domainName()); + Assertions.assertEquals("pyyrmfs", model.dns().nameserverIPAddresses().get(0)); + Assertions.assertEquals(4610339320478371980L, model.dns().replicas()); + Assertions.assertTrue(model.dns().preferK8SDnsForPtrLookups()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorStatusTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorStatusTests.java new file mode 100644 index 000000000000..6f99f54409bf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorStatusTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryConnectorStatus; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ActiveDirectoryConnectorStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActiveDirectoryConnectorStatus model = BinaryData.fromString( + "{\"lastUpdateTime\":\"cbvopwndyqleallk\",\"observedGeneration\":5261993495956780218,\"state\":\"lowkxxpvb\",\"tlhikcyychun\":\"\\\"datajmzsyzfh\\\"\",\"uic\":\"\\\"datajlpjrtwszhv\\\"\",\"ubhvj\":\"\\\"datahvtrrmhwrbfdpyf\\\"\"}") + .toObject(ActiveDirectoryConnectorStatus.class); + Assertions.assertEquals("cbvopwndyqleallk", model.lastUpdateTime()); + Assertions.assertEquals(5261993495956780218L, model.observedGeneration()); + Assertions.assertEquals("lowkxxpvb", model.state()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActiveDirectoryConnectorStatus model + = new ActiveDirectoryConnectorStatus().withLastUpdateTime("cbvopwndyqleallk") + .withObservedGeneration(5261993495956780218L) + .withState("lowkxxpvb") + .withAdditionalProperties(mapOf("ubhvj", "\"datahvtrrmhwrbfdpyf\"", "tlhikcyychun", "\"datajmzsyzfh\"", + "uic", "\"datajlpjrtwszhv\"")); + model = BinaryData.fromObject(model).toObject(ActiveDirectoryConnectorStatus.class); + Assertions.assertEquals("cbvopwndyqleallk", model.lastUpdateTime()); + Assertions.assertEquals(5261993495956780218L, model.observedGeneration()); + Assertions.assertEquals("lowkxxpvb", model.state()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteMockTests.java new file mode 100644 index 000000000000..ec92cd1455a9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryConnectorsDeleteMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ActiveDirectoryConnectorsDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.activeDirectoryConnectors() + .delete("cdhdyswcrpt", "eajczxvlgsrgkr", "izrpywlptyuqhrl", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryDomainControllerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryDomainControllerTests.java new file mode 100644 index 000000000000..27fd0c030cc1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryDomainControllerTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import org.junit.jupiter.api.Assertions; + +public final class ActiveDirectoryDomainControllerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActiveDirectoryDomainController model + = BinaryData.fromString("{\"hostname\":\"saoafcluqvox\"}").toObject(ActiveDirectoryDomainController.class); + Assertions.assertEquals("saoafcluqvox", model.hostname()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActiveDirectoryDomainController model = new ActiveDirectoryDomainController().withHostname("saoafcluqvox"); + model = BinaryData.fromObject(model).toObject(ActiveDirectoryDomainController.class); + Assertions.assertEquals("saoafcluqvox", model.hostname()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryDomainControllersTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryDomainControllersTests.java new file mode 100644 index 000000000000..8a124723b0f0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ActiveDirectoryDomainControllersTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainController; +import com.azure.resourcemanager.azurearcdata.models.ActiveDirectoryDomainControllers; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ActiveDirectoryDomainControllersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActiveDirectoryDomainControllers model = BinaryData.fromString( + "{\"primaryDomainController\":{\"hostname\":\"b\"},\"secondaryDomainControllers\":[{\"hostname\":\"rfsiowlkjxn\"},{\"hostname\":\"pvwgfstmhqykizmd\"}]}") + .toObject(ActiveDirectoryDomainControllers.class); + Assertions.assertEquals("b", model.primaryDomainController().hostname()); + Assertions.assertEquals("rfsiowlkjxn", model.secondaryDomainControllers().get(0).hostname()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActiveDirectoryDomainControllers model = new ActiveDirectoryDomainControllers() + .withPrimaryDomainController(new ActiveDirectoryDomainController().withHostname("b")) + .withSecondaryDomainControllers( + Arrays.asList(new ActiveDirectoryDomainController().withHostname("rfsiowlkjxn"), + new ActiveDirectoryDomainController().withHostname("pvwgfstmhqykizmd"))); + model = BinaryData.fromObject(model).toObject(ActiveDirectoryDomainControllers.class); + Assertions.assertEquals("b", model.primaryDomainController().hostname()); + Assertions.assertEquals("rfsiowlkjxn", model.secondaryDomainControllers().get(0).hostname()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ArcSqlServerAvailabilityGroupListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ArcSqlServerAvailabilityGroupListResultTests.java new file mode 100644 index 000000000000..07c3d97a99f0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ArcSqlServerAvailabilityGroupListResultTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerAvailabilityGroupListResult; + +public final class ArcSqlServerAvailabilityGroupListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ArcSqlServerAvailabilityGroupListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"availabilityGroupId\":\"zxnfaaz\",\"serverName\":\"dtnkdmkq\",\"instanceName\":\"lwuenvrkp\",\"vmId\":\"uaibrebqaaysj\",\"collectionTimestamp\":\"2021-08-01T02:36:26Z\",\"info\":{\"failureConditionLevel\":1659920378,\"healthCheckTimeout\":1555595528,\"automatedBackupPreferenceDescription\":\"ezl\",\"version\":1601840251,\"basicFeatures\":false,\"dtcSupport\":false,\"dbFailover\":false,\"isDistributed\":true,\"clusterTypeDescription\":\"m\",\"requiredSynchronizedSecondariesToCommit\":147103484,\"isContained\":true,\"primaryReplica\":\"mjihyeozphv\",\"primaryRecoveryHealthDescription\":\"uyqncygupkvipmd\",\"secondaryRecoveryHealthDescription\":\"wx\",\"synchronizationHealthDescription\":\"pevzhfst\",\"replicationPartnerType\":\"AzureSQLVM\",\"listener\":{\"dnsName\":\"jujbypelmcuvhixb\",\"ipV4AddressesAndMasks\":[{},{}],\"ipV6Addresses\":[\"n\"],\"port\":156258046}},\"replicas\":{\"value\":[{}],\"nextLink\":\"sttp\"},\"databases\":{\"value\":[{},{}],\"nextLink\":\"bnujrywvtylbf\"},\"provisioningState\":\"curdoiwiitht\"},\"location\":\"ubxcbihw\",\"tags\":{\"umwctondz\":\"fdntwjchrdgoih\"},\"id\":\"luudfdlwggytsb\",\"name\":\"tov\",\"type\":\"tgseinqfiufxqkn\"},{\"properties\":{\"availabilityGroupId\":\"rgnepttwqmsniffc\",\"serverName\":\"qnrojlpijnkrxfrd\",\"instanceName\":\"c\",\"vmId\":\"tizzronasxif\",\"collectionTimestamp\":\"2021-08-28T08:11:06Z\",\"info\":{\"failureConditionLevel\":418200584,\"healthCheckTimeout\":26724739,\"automatedBackupPreferenceDescription\":\"wesgogczh\",\"version\":1907577103,\"basicFeatures\":false,\"dtcSupport\":false,\"dbFailover\":true,\"isDistributed\":true,\"clusterTypeDescription\":\"ossxk\",\"requiredSynchronizedSecondariesToCommit\":1541552181,\"isContained\":true,\"primaryReplica\":\"gh\",\"primaryRecoveryHealthDescription\":\"bdhqxvcxgf\",\"secondaryRecoveryHealthDescription\":\"dsofbshrns\",\"synchronizationHealthDescription\":\"uswdv\",\"replicationPartnerType\":\"AzureSQLManagedInstance\",\"listener\":{\"dnsName\":\"cnunvjsr\",\"ipV4AddressesAndMasks\":[{}],\"ipV6Addresses\":[\"nopqgikyzirtx\",\"yuxzejntpsewgi\",\"ilqu\",\"rydxtqm\"],\"port\":323647852}},\"replicas\":{\"value\":[{},{}],\"nextLink\":\"gufhyaomtbg\"},\"databases\":{\"value\":[{},{}],\"nextLink\":\"rvk\"},\"provisioningState\":\"ovjzhpjbibgjmfx\"},\"location\":\"vfcluyovwxnbkfe\",\"tags\":{\"g\":\"scyhwz\",\"vp\":\"rujbzbomvzzbtdc\",\"n\":\"iyujviylwdshfs\",\"rymsgaojfmw\":\"bgye\"},\"id\":\"cotmr\",\"name\":\"hirctymoxoftpipi\",\"type\":\"yczuhxacpq\"}],\"nextLink\":\"ihhyuspskasd\"}") + .toObject(ArcSqlServerAvailabilityGroupListResult.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ArcSqlServerDatabaseListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ArcSqlServerDatabaseListResultTests.java new file mode 100644 index 000000000000..0e595d2719f0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ArcSqlServerDatabaseListResultTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.ArcSqlServerDatabaseListResult; + +public final class ArcSqlServerDatabaseListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ArcSqlServerDatabaseListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"collationName\":\"ifgh\",\"databaseCreationDate\":\"2021-11-03T11:50:52Z\",\"compatibilityLevel\":237028696,\"sizeMB\":27.253170156472674,\"logFileSizeMB\":44.879216245467,\"dataFileSizeMB\":50.85190361960542,\"spaceAvailableMB\":72.34230686443,\"state\":\"Emergency\",\"isReadOnly\":true,\"recoveryMode\":\"Bulk-logged\",\"databaseOptions\":{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":false,\"isAutoCreateStatsOn\":true,\"isAutoUpdateStatsOn\":false,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":true,\"isEncrypted\":true,\"isTrustworthyOn\":false,\"isHekatonFilesOn\":true,\"numberOfHekatonFiles\":1042421477},\"backupInformation\":{\"lastFullBackup\":\"2020-12-26T21:45:19Z\",\"lastLogBackup\":\"2021-04-07T03:36:59Z\"},\"backupPolicy\":{\"retentionPeriodDays\":810909515,\"fullBackupDays\":1127621123,\"differentialBackupHours\":12,\"transactionLogBackupMinutes\":865921989},\"earliestRestoreDate\":\"2021-11-03T02:13:24Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"njuhpsprkzya\",\"vmId\":\"ia\",\"restorePointInTime\":\"2021-05-17T09:46:40Z\",\"provisioningState\":\"afbwqroohtuovmao\",\"lastDatabaseUploadTime\":\"2021-10-17T07:17:44Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-09-10T23:43:46Z\",\"targetRecommendationGenerationTime\":\"2021-01-19T18:40:50Z\",\"databaseAssessments\":[{}],\"targetReadiness\":{}},\"jobs\":[{},{},{}]}},\"location\":\"mslclblyjxlt\",\"tags\":{\"f\":\"uscv\",\"cydrtceukdqkk\":\"igctmgxuupbezq\"},\"id\":\"ihztgeqmgqzgwldo\",\"name\":\"chillcecf\",\"type\":\"huwaoaguhic\"},{\"properties\":{\"collationName\":\"lizst\",\"databaseCreationDate\":\"2021-11-29T00:03:44Z\",\"compatibilityLevel\":1721395359,\"sizeMB\":27.934833430359397,\"logFileSizeMB\":28.153419619445664,\"dataFileSizeMB\":61.33829492206038,\"spaceAvailableMB\":8.696554014717472,\"state\":\"Emergency\",\"isReadOnly\":false,\"recoveryMode\":\"Full\",\"databaseOptions\":{\"isAutoCloseOn\":true,\"isAutoShrinkOn\":false,\"isAutoCreateStatsOn\":true,\"isAutoUpdateStatsOn\":true,\"isRemoteDataArchiveEnabled\":true,\"isMemoryOptimizationEnabled\":true,\"isEncrypted\":true,\"isTrustworthyOn\":true,\"isHekatonFilesOn\":false,\"numberOfHekatonFiles\":506082},\"backupInformation\":{\"lastFullBackup\":\"2021-03-21T07:38:48Z\",\"lastLogBackup\":\"2021-02-19T16:09:40Z\"},\"backupPolicy\":{\"retentionPeriodDays\":1880986273,\"fullBackupDays\":1955098826,\"differentialBackupHours\":24,\"transactionLogBackupMinutes\":414551493},\"earliestRestoreDate\":\"2021-01-30T00:30:57Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"rtywi\",\"vmId\":\"mhlaku\",\"restorePointInTime\":\"2021-06-12T20:26:25Z\",\"provisioningState\":\"hgauacdixmxufrs\",\"lastDatabaseUploadTime\":\"2021-04-28T00:47:08Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-08-22T20:17:57Z\",\"targetRecommendationGenerationTime\":\"2021-07-20T20:02:01Z\",\"databaseAssessments\":[{}],\"targetReadiness\":{}},\"jobs\":[{},{},{},{}]}},\"location\":\"bvjhvefgwbmqj\",\"tags\":{\"mqkyojwyvfkmbts\":\"tasfaymxbulpzeal\",\"rrscubiwsdrnp\":\"ahxsgxjcmm\",\"jrmmuabwib\":\"qwodiffjx\"},\"id\":\"jogjonmc\",\"name\":\"e\",\"type\":\"oyzbamwineofvf\"},{\"properties\":{\"collationName\":\"kpoldtvevboc\",\"databaseCreationDate\":\"2021-03-19T15:36:01Z\",\"compatibilityLevel\":1310534939,\"sizeMB\":0.8652371964113059,\"logFileSizeMB\":38.021880797801046,\"dataFileSizeMB\":61.251523393969165,\"spaceAvailableMB\":71.49211645325077,\"state\":\"Restoring\",\"isReadOnly\":true,\"recoveryMode\":\"Bulk-logged\",\"databaseOptions\":{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":true,\"isAutoCreateStatsOn\":true,\"isAutoUpdateStatsOn\":false,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":true,\"isEncrypted\":true,\"isTrustworthyOn\":false,\"isHekatonFilesOn\":true,\"numberOfHekatonFiles\":852275827},\"backupInformation\":{\"lastFullBackup\":\"2021-06-29T00:00:09Z\",\"lastLogBackup\":\"2021-01-24T19:32:08Z\"},\"backupPolicy\":{\"retentionPeriodDays\":224875316,\"fullBackupDays\":1274486190,\"differentialBackupHours\":12,\"transactionLogBackupMinutes\":2066637726},\"earliestRestoreDate\":\"2021-08-06T22:59:54Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"lcouqehbhbcdszir\",\"vmId\":\"an\",\"restorePointInTime\":\"2021-02-28T23:17:40Z\",\"provisioningState\":\"mbltoo\",\"lastDatabaseUploadTime\":\"2021-05-13T21:00:02Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-02-24T06:54:09Z\",\"targetRecommendationGenerationTime\":\"2021-03-07T21:54:57Z\",\"databaseAssessments\":[{},{}],\"targetReadiness\":{}},\"jobs\":[{},{}]}},\"location\":\"ygaolnjpnnb\",\"tags\":{\"jxxahmrnad\":\"sibjgs\",\"iv\":\"yqegx\",\"bjijkgqxnh\":\"inbmh\"},\"id\":\"bkezn\",\"name\":\"aujvaa\",\"type\":\"nggiycwkdtaa\"},{\"properties\":{\"collationName\":\"wfekaumrrqmb\",\"databaseCreationDate\":\"2021-12-03T14:12:38Z\",\"compatibilityLevel\":330516260,\"sizeMB\":56.8599489624235,\"logFileSizeMB\":30.355189246094316,\"dataFileSizeMB\":16.494645848882328,\"spaceAvailableMB\":86.74258398537008,\"state\":\"Online\",\"isReadOnly\":false,\"recoveryMode\":\"Bulk-logged\",\"databaseOptions\":{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":true,\"isAutoCreateStatsOn\":false,\"isAutoUpdateStatsOn\":false,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":true,\"isEncrypted\":false,\"isTrustworthyOn\":true,\"isHekatonFilesOn\":false,\"numberOfHekatonFiles\":952853749},\"backupInformation\":{\"lastFullBackup\":\"2021-08-10T16:12:14Z\",\"lastLogBackup\":\"2020-12-25T09:19:44Z\"},\"backupPolicy\":{\"retentionPeriodDays\":919967647,\"fullBackupDays\":598717538,\"differentialBackupHours\":12,\"transactionLogBackupMinutes\":1781850881},\"earliestRestoreDate\":\"2021-01-04T18:23:18Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"utycyarnroohguab\",\"vmId\":\"ghktdpy\",\"restorePointInTime\":\"2021-06-20T11:43:07Z\",\"provisioningState\":\"oeocnhzqrott\",\"lastDatabaseUploadTime\":\"2021-02-11T03:21:27Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-05-08T05:22:41Z\",\"targetRecommendationGenerationTime\":\"2021-05-03T22:15:41Z\",\"databaseAssessments\":[{}],\"targetReadiness\":{}},\"jobs\":[{}]}},\"location\":\"pqinf\",\"tags\":{\"xpjb\":\"yglqdhmrjzral\",\"jenkyh\":\"ypsjoq\",\"xfxjelgcmpzqj\":\"qzvs\",\"s\":\"hhqxuwyvcacoyviv\"},\"id\":\"zusjsz\",\"name\":\"bscm\",\"type\":\"lzijiufehgmvflnw\"}],\"nextLink\":\"qkxrerl\"}") + .toObject(ArcSqlServerDatabaseListResult.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AuthenticationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AuthenticationTests.java new file mode 100644 index 000000000000..62b7a86ac007 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AuthenticationTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.Authentication; +import com.azure.resourcemanager.azurearcdata.models.EntraAuthentication; +import com.azure.resourcemanager.azurearcdata.models.IdentityType; +import com.azure.resourcemanager.azurearcdata.models.Mode; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AuthenticationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Authentication model = BinaryData.fromString( + "{\"mode\":\"Undefined\",\"sqlServerEntraIdentity\":[{\"identityType\":\"UserAssignedManagedIdentity\",\"clientId\":\"dndrdvstkwqqtche\"},{\"identityType\":\"UserAssignedManagedIdentity\",\"clientId\":\"mtdaa\"},{\"identityType\":\"SystemAssignedManagedIdentity\",\"clientId\":\"wvgpiohg\"},{\"identityType\":\"UserAssignedManagedIdentity\",\"clientId\":\"fudxepxgyqagvrv\"}]}") + .toObject(Authentication.class); + Assertions.assertEquals(Mode.UNDEFINED, model.mode()); + Assertions.assertEquals(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY, + model.sqlServerEntraIdentity().get(0).identityType()); + Assertions.assertEquals("dndrdvstkwqqtche", model.sqlServerEntraIdentity().get(0).clientId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Authentication model = new Authentication().withMode(Mode.UNDEFINED) + .withSqlServerEntraIdentity(Arrays.asList( + new EntraAuthentication().withIdentityType(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY) + .withClientId("dndrdvstkwqqtche"), + new EntraAuthentication().withIdentityType(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY) + .withClientId("mtdaa"), + new EntraAuthentication().withIdentityType(IdentityType.SYSTEM_ASSIGNED_MANAGED_IDENTITY) + .withClientId("wvgpiohg"), + new EntraAuthentication().withIdentityType(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY) + .withClientId("fudxepxgyqagvrv"))); + model = BinaryData.fromObject(model).toObject(Authentication.class); + Assertions.assertEquals(Mode.UNDEFINED, model.mode()); + Assertions.assertEquals(IdentityType.USER_ASSIGNED_MANAGED_IDENTITY, + model.sqlServerEntraIdentity().get(0).identityType()); + Assertions.assertEquals("dndrdvstkwqqtche", model.sqlServerEntraIdentity().get(0).clientId()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupConfigureTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupConfigureTests.java new file mode 100644 index 000000000000..2eb7d32b89b2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupConfigureTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import org.junit.jupiter.api.Assertions; + +public final class AvailabilityGroupConfigureTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailabilityGroupConfigure model = BinaryData.fromString( + "{\"endpointName\":\"nsrmffeycx\",\"endpointUrl\":\"tpiymerteea\",\"endpointAuthenticationMode\":\"Windows_NTLM\",\"certificateName\":\"iekkkzddrtkgdojb\",\"endpointConnectLogin\":\"vavrefdees\",\"availabilityMode\":\"SYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"ijpxtx\",\"failoverMode\":\"MANUAL\",\"failoverModeDescription\":\"rtujwsawddjibab\",\"sessionTimeout\":1620106663,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"v\",\"secondaryAllowConnections\":\"NO\",\"secondaryRoleAllowConnectionsDescription\":\"xavo\",\"replicaCreateDate\":\"2021-01-11T06:40:13Z\",\"replicaModifyDate\":\"2021-07-21T07:36:08Z\",\"backupPriority\":420576736,\"readOnlyRoutingUrl\":\"m\",\"readWriteRoutingUrl\":\"bwpypqtgsfjacb\",\"seedingMode\":\"AUTOMATIC\",\"seedingModeDescription\":\"xudb\"}") + .toObject(AvailabilityGroupConfigure.class); + Assertions.assertEquals("nsrmffeycx", model.endpointName()); + Assertions.assertEquals("tpiymerteea", model.endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM, model.endpointAuthenticationMode()); + Assertions.assertEquals("iekkkzddrtkgdojb", model.certificateName()); + Assertions.assertEquals("vavrefdees", model.endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, model.availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, model.failoverMode()); + Assertions.assertEquals(1620106663, model.sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, model.primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.NO, model.secondaryAllowConnections()); + Assertions.assertEquals(420576736, model.backupPriority()); + Assertions.assertEquals("m", model.readOnlyRoutingUrl()); + Assertions.assertEquals("bwpypqtgsfjacb", model.readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.seedingMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvailabilityGroupConfigure model = new AvailabilityGroupConfigure().withEndpointName("nsrmffeycx") + .withEndpointUrl("tpiymerteea") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NTLM) + .withCertificateName("iekkkzddrtkgdojb") + .withEndpointConnectLogin("vavrefdees") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSessionTimeout(1620106663) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.NO) + .withBackupPriority(420576736) + .withReadOnlyRoutingUrl("m") + .withReadWriteRoutingUrl("bwpypqtgsfjacb") + .withSeedingMode(SeedingMode.AUTOMATIC); + model = BinaryData.fromObject(model).toObject(AvailabilityGroupConfigure.class); + Assertions.assertEquals("nsrmffeycx", model.endpointName()); + Assertions.assertEquals("tpiymerteea", model.endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM, model.endpointAuthenticationMode()); + Assertions.assertEquals("iekkkzddrtkgdojb", model.certificateName()); + Assertions.assertEquals("vavrefdees", model.endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, model.availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, model.failoverMode()); + Assertions.assertEquals(1620106663, model.sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, model.primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.NO, model.secondaryAllowConnections()); + Assertions.assertEquals(420576736, model.backupPriority()); + Assertions.assertEquals("m", model.readOnlyRoutingUrl()); + Assertions.assertEquals("bwpypqtgsfjacb", model.readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.seedingMode()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupCreateUpdateConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupCreateUpdateConfigurationTests.java new file mode 100644 index 000000000000..b4403818b830 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupCreateUpdateConfigurationTests.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AvailabilityGroupCreateUpdateConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailabilityGroupCreateUpdateConfiguration model = BinaryData.fromString( + "{\"availabilityGroupName\":\"sihclafzvaylp\",\"replicas\":[{\"serverInstance\":\"qwztcmwqkc\",\"endpointName\":\"xwaxfewzjkj\",\"endpointUrl\":\"fdeqvhpsyl\",\"endpointAuthenticationMode\":\"Certificate_Windows_Kerberos\",\"certificateName\":\"kbffmbmx\",\"endpointConnectLogin\":\"rgywwp\",\"availabilityMode\":\"SYNCHRONOUS_COMMIT\",\"failoverMode\":\"MANUAL\",\"seedingMode\":\"AUTOMATIC\",\"backupPriority\":277669482,\"secondaryRoleAllowConnections\":\"ALL\",\"secondaryRoleReadOnlyRoutingUrl\":\"cg\",\"primaryRoleAllowConnections\":\"ALL\",\"primaryRoleReadOnlyRoutingList\":[\"ttaqutdew\",\"mxswvruunzz\"],\"sessionTimeout\":1170666109}],\"databases\":[\"fkimrtix\",\"kffqyinljqepqwh\",\"xmonstshi\"],\"automatedBackupPreference\":\"SECONDARY_ONLY\",\"failureConditionLevel\":2,\"healthCheckTimeout\":1196099059,\"dbFailover\":\"ON\",\"dtcSupport\":\"NONE\",\"requiredSynchronizedSecondariesToCommit\":385989453,\"clusterType\":\"NONE\",\"listener\":{\"dnsName\":\"svu\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"iegstm\",\"mask\":\"nwjizcilnghgshej\"}],\"ipV6Addresses\":[\"xqmul\",\"xlxqzvn\"],\"port\":1381551038}}") + .toObject(AvailabilityGroupCreateUpdateConfiguration.class); + Assertions.assertEquals("sihclafzvaylp", model.availabilityGroupName()); + Assertions.assertEquals("qwztcmwqkc", model.replicas().get(0).serverInstance()); + Assertions.assertEquals("xwaxfewzjkj", model.replicas().get(0).endpointName()); + Assertions.assertEquals("fdeqvhpsyl", model.replicas().get(0).endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.replicas().get(0).endpointAuthenticationMode()); + Assertions.assertEquals("kbffmbmx", model.replicas().get(0).certificateName()); + Assertions.assertEquals("rgywwp", model.replicas().get(0).endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, + model.replicas().get(0).availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, model.replicas().get(0).failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.replicas().get(0).seedingMode()); + Assertions.assertEquals(277669482, model.replicas().get(0).backupPriority()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, model.replicas().get(0).secondaryRoleAllowConnections()); + Assertions.assertEquals("cg", model.replicas().get(0).secondaryRoleReadOnlyRoutingUrl()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, model.replicas().get(0).primaryRoleAllowConnections()); + Assertions.assertEquals("ttaqutdew", model.replicas().get(0).primaryRoleReadOnlyRoutingList().get(0)); + Assertions.assertEquals(1170666109, model.replicas().get(0).sessionTimeout()); + Assertions.assertEquals("fkimrtix", model.databases().get(0)); + Assertions.assertEquals(AutomatedBackupPreference.SECONDARY_ONLY, model.automatedBackupPreference()); + Assertions.assertEquals(FailureConditionLevel.TWO, model.failureConditionLevel()); + Assertions.assertEquals(1196099059, model.healthCheckTimeout()); + Assertions.assertEquals(DbFailover.ON, model.dbFailover()); + Assertions.assertEquals(DtcSupport.NONE, model.dtcSupport()); + Assertions.assertEquals(385989453, model.requiredSynchronizedSecondariesToCommit()); + Assertions.assertEquals(ClusterType.NONE, model.clusterType()); + Assertions.assertEquals("svu", model.listener().dnsName()); + Assertions.assertEquals("iegstm", model.listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("nwjizcilnghgshej", model.listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("xqmul", model.listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1381551038, model.listener().port()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvailabilityGroupCreateUpdateConfiguration model = new AvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("sihclafzvaylp") + .withReplicas( + Arrays.asList(new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("qwztcmwqkc") + .withEndpointName("xwaxfewzjkj") + .withEndpointUrl("fdeqvhpsyl") + .withEndpointAuthenticationMode(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS) + .withCertificateName("kbffmbmx") + .withEndpointConnectLogin("rgywwp") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(277669482) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withSecondaryRoleReadOnlyRoutingUrl("cg") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList(Arrays.asList("ttaqutdew", "mxswvruunzz")) + .withSessionTimeout(1170666109))) + .withDatabases(Arrays.asList("fkimrtix", "kffqyinljqepqwh", "xmonstshi")) + .withAutomatedBackupPreference(AutomatedBackupPreference.SECONDARY_ONLY) + .withFailureConditionLevel(FailureConditionLevel.TWO) + .withHealthCheckTimeout(1196099059) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.NONE) + .withRequiredSynchronizedSecondariesToCommit(385989453) + .withClusterType(ClusterType.NONE) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("svu") + .withIpV4AddressesAndMasks( + Arrays.asList(new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("iegstm") + .withMask("nwjizcilnghgshej"))) + .withIpV6Addresses(Arrays.asList("xqmul", "xlxqzvn")) + .withPort(1381551038)); + model = BinaryData.fromObject(model).toObject(AvailabilityGroupCreateUpdateConfiguration.class); + Assertions.assertEquals("sihclafzvaylp", model.availabilityGroupName()); + Assertions.assertEquals("qwztcmwqkc", model.replicas().get(0).serverInstance()); + Assertions.assertEquals("xwaxfewzjkj", model.replicas().get(0).endpointName()); + Assertions.assertEquals("fdeqvhpsyl", model.replicas().get(0).endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.replicas().get(0).endpointAuthenticationMode()); + Assertions.assertEquals("kbffmbmx", model.replicas().get(0).certificateName()); + Assertions.assertEquals("rgywwp", model.replicas().get(0).endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, + model.replicas().get(0).availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, model.replicas().get(0).failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.replicas().get(0).seedingMode()); + Assertions.assertEquals(277669482, model.replicas().get(0).backupPriority()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, model.replicas().get(0).secondaryRoleAllowConnections()); + Assertions.assertEquals("cg", model.replicas().get(0).secondaryRoleReadOnlyRoutingUrl()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, model.replicas().get(0).primaryRoleAllowConnections()); + Assertions.assertEquals("ttaqutdew", model.replicas().get(0).primaryRoleReadOnlyRoutingList().get(0)); + Assertions.assertEquals(1170666109, model.replicas().get(0).sessionTimeout()); + Assertions.assertEquals("fkimrtix", model.databases().get(0)); + Assertions.assertEquals(AutomatedBackupPreference.SECONDARY_ONLY, model.automatedBackupPreference()); + Assertions.assertEquals(FailureConditionLevel.TWO, model.failureConditionLevel()); + Assertions.assertEquals(1196099059, model.healthCheckTimeout()); + Assertions.assertEquals(DbFailover.ON, model.dbFailover()); + Assertions.assertEquals(DtcSupport.NONE, model.dtcSupport()); + Assertions.assertEquals(385989453, model.requiredSynchronizedSecondariesToCommit()); + Assertions.assertEquals(ClusterType.NONE, model.clusterType()); + Assertions.assertEquals("svu", model.listener().dnsName()); + Assertions.assertEquals("iegstm", model.listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("nwjizcilnghgshej", model.listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("xqmul", model.listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1381551038, model.listener().port()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupCreateUpdateReplicaConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupCreateUpdateReplicaConfigurationTests.java new file mode 100644 index 000000000000..167429f1c6e5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupCreateUpdateReplicaConfigurationTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AvailabilityGroupCreateUpdateReplicaConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailabilityGroupCreateUpdateReplicaConfiguration model = BinaryData.fromString( + "{\"serverInstance\":\"ycucrwnamikzeb\",\"endpointName\":\"bsmswziqgf\",\"endpointUrl\":\"okzrus\",\"endpointAuthenticationMode\":\"Certificate_Windows_NTLM\",\"certificateName\":\"czznvfbycjsxj\",\"endpointConnectLogin\":\"i\",\"availabilityMode\":\"SYNCHRONOUS_COMMIT\",\"failoverMode\":\"NONE\",\"seedingMode\":\"MANUAL\",\"backupPriority\":260719859,\"secondaryRoleAllowConnections\":\"NO\",\"secondaryRoleReadOnlyRoutingUrl\":\"vnoamldseha\",\"primaryRoleAllowConnections\":\"ALL\",\"primaryRoleReadOnlyRoutingList\":[\"hflzokxco\",\"pelnjetag\"],\"sessionTimeout\":1066573650}") + .toObject(AvailabilityGroupCreateUpdateReplicaConfiguration.class); + Assertions.assertEquals("ycucrwnamikzeb", model.serverInstance()); + Assertions.assertEquals("bsmswziqgf", model.endpointName()); + Assertions.assertEquals("okzrus", model.endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_NTLM, model.endpointAuthenticationMode()); + Assertions.assertEquals("czznvfbycjsxj", model.certificateName()); + Assertions.assertEquals("i", model.endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, model.availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.NONE, model.failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, model.seedingMode()); + Assertions.assertEquals(260719859, model.backupPriority()); + Assertions.assertEquals(SecondaryAllowConnections.NO, model.secondaryRoleAllowConnections()); + Assertions.assertEquals("vnoamldseha", model.secondaryRoleReadOnlyRoutingUrl()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, model.primaryRoleAllowConnections()); + Assertions.assertEquals("hflzokxco", model.primaryRoleReadOnlyRoutingList().get(0)); + Assertions.assertEquals(1066573650, model.sessionTimeout()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvailabilityGroupCreateUpdateReplicaConfiguration model + = new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("ycucrwnamikzeb") + .withEndpointName("bsmswziqgf") + .withEndpointUrl("okzrus") + .withEndpointAuthenticationMode(ConnectionAuth.CERTIFICATE_WINDOWS_NTLM) + .withCertificateName("czznvfbycjsxj") + .withEndpointConnectLogin("i") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.MANUAL) + .withBackupPriority(260719859) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.NO) + .withSecondaryRoleReadOnlyRoutingUrl("vnoamldseha") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList(Arrays.asList("hflzokxco", "pelnjetag")) + .withSessionTimeout(1066573650); + model = BinaryData.fromObject(model).toObject(AvailabilityGroupCreateUpdateReplicaConfiguration.class); + Assertions.assertEquals("ycucrwnamikzeb", model.serverInstance()); + Assertions.assertEquals("bsmswziqgf", model.endpointName()); + Assertions.assertEquals("okzrus", model.endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_NTLM, model.endpointAuthenticationMode()); + Assertions.assertEquals("czznvfbycjsxj", model.certificateName()); + Assertions.assertEquals("i", model.endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, model.availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.NONE, model.failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, model.seedingMode()); + Assertions.assertEquals(260719859, model.backupPriority()); + Assertions.assertEquals(SecondaryAllowConnections.NO, model.secondaryRoleAllowConnections()); + Assertions.assertEquals("vnoamldseha", model.secondaryRoleReadOnlyRoutingUrl()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, model.primaryRoleAllowConnections()); + Assertions.assertEquals("hflzokxco", model.primaryRoleReadOnlyRoutingList().get(0)); + Assertions.assertEquals(1066573650, model.sessionTimeout()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupInfoTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupInfoTests.java new file mode 100644 index 000000000000..1610224511c8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupInfoTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AvailabilityGroupInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailabilityGroupInfo model = BinaryData.fromString( + "{\"failureConditionLevel\":559974778,\"healthCheckTimeout\":1362620391,\"automatedBackupPreferenceDescription\":\"lfkqojpy\",\"version\":811580474,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":false,\"isDistributed\":false,\"clusterTypeDescription\":\"zsdymbrnysuxmpra\",\"requiredSynchronizedSecondariesToCommit\":117142213,\"isContained\":true,\"primaryReplica\":\"ocxvdfffwafqr\",\"primaryRecoveryHealthDescription\":\"daspavehhrvk\",\"secondaryRecoveryHealthDescription\":\"n\",\"synchronizationHealthDescription\":\"zudhcxg\",\"replicationPartnerType\":\"AzureSQLManagedInstance\",\"listener\":{\"dnsName\":\"cdyuibhmfdnbzyd\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"cjnaeoisrvhmgor\",\"mask\":\"ukiscvwmzhw\"},{\"ipAddress\":\"efaxvxilc\",\"mask\":\"gnhnzeyq\"},{\"ipAddress\":\"jjfzqlqhycavo\",\"mask\":\"gxdbeesmie\"},{\"ipAddress\":\"lrariaawiu\",\"mask\":\"ydwqfbylyrf\"}],\"ipV6Addresses\":[\"gtcojocqwo\"],\"port\":711693254}}") + .toObject(AvailabilityGroupInfo.class); + Assertions.assertEquals(559974778, model.failureConditionLevel()); + Assertions.assertEquals(1362620391, model.healthCheckTimeout()); + Assertions.assertTrue(model.basicFeatures()); + Assertions.assertFalse(model.dtcSupport()); + Assertions.assertFalse(model.dbFailover()); + Assertions.assertFalse(model.isDistributed()); + Assertions.assertEquals(117142213, model.requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(model.isContained()); + Assertions.assertEquals("cdyuibhmfdnbzyd", model.listener().dnsName()); + Assertions.assertEquals("cjnaeoisrvhmgor", model.listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("ukiscvwmzhw", model.listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("gtcojocqwo", model.listener().ipV6Addresses().get(0)); + Assertions.assertEquals(711693254, model.listener().port()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvailabilityGroupInfo model = new AvailabilityGroupInfo().withFailureConditionLevel(559974778) + .withHealthCheckTimeout(1362620391) + .withBasicFeatures(true) + .withDtcSupport(false) + .withDbFailover(false) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(117142213) + .withIsContained(true) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("cdyuibhmfdnbzyd") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("cjnaeoisrvhmgor") + .withMask("ukiscvwmzhw"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("efaxvxilc") + .withMask("gnhnzeyq"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("jjfzqlqhycavo") + .withMask("gxdbeesmie"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("lrariaawiu") + .withMask("ydwqfbylyrf"))) + .withIpV6Addresses(Arrays.asList("gtcojocqwo")) + .withPort(711693254)); + model = BinaryData.fromObject(model).toObject(AvailabilityGroupInfo.class); + Assertions.assertEquals(559974778, model.failureConditionLevel()); + Assertions.assertEquals(1362620391, model.healthCheckTimeout()); + Assertions.assertTrue(model.basicFeatures()); + Assertions.assertFalse(model.dtcSupport()); + Assertions.assertFalse(model.dbFailover()); + Assertions.assertFalse(model.isDistributed()); + Assertions.assertEquals(117142213, model.requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(model.isContained()); + Assertions.assertEquals("cdyuibhmfdnbzyd", model.listener().dnsName()); + Assertions.assertEquals("cjnaeoisrvhmgor", model.listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("ukiscvwmzhw", model.listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("gtcojocqwo", model.listener().ipV6Addresses().get(0)); + Assertions.assertEquals(711693254, model.listener().port()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupRetrievalFiltersTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupRetrievalFiltersTests.java new file mode 100644 index 000000000000..d5ddb71387ed --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupRetrievalFiltersTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupTypeFilter; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.ReplicationPartnerType; +import org.junit.jupiter.api.Assertions; + +public final class AvailabilityGroupRetrievalFiltersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailabilityGroupRetrievalFilters model = BinaryData.fromString( + "{\"availabilityGroupTypeFilter\":\"CONTAINED\",\"replicationPartnerTypeFilter\":\"AzureSQLManagedInstance\"}") + .toObject(AvailabilityGroupRetrievalFilters.class); + Assertions.assertEquals(ArcSqlServerAvailabilityGroupTypeFilter.CONTAINED, model.availabilityGroupTypeFilter()); + Assertions.assertEquals(ReplicationPartnerType.AZURE_SQLMANAGED_INSTANCE, model.replicationPartnerTypeFilter()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvailabilityGroupRetrievalFilters model = new AvailabilityGroupRetrievalFilters() + .withAvailabilityGroupTypeFilter(ArcSqlServerAvailabilityGroupTypeFilter.CONTAINED) + .withReplicationPartnerTypeFilter(ReplicationPartnerType.AZURE_SQLMANAGED_INSTANCE); + model = BinaryData.fromObject(model).toObject(AvailabilityGroupRetrievalFilters.class); + Assertions.assertEquals(ArcSqlServerAvailabilityGroupTypeFilter.CONTAINED, model.availabilityGroupTypeFilter()); + Assertions.assertEquals(ReplicationPartnerType.AZURE_SQLMANAGED_INSTANCE, model.replicationPartnerTypeFilter()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupStateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupStateTests.java new file mode 100644 index 000000000000..815b3075d658 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/AvailabilityGroupStateTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; + +public final class AvailabilityGroupStateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailabilityGroupState model = BinaryData.fromString( + "{\"availabilityGroupReplicaRole\":\"odhtnsirudhzm\",\"operationalStateDescription\":\"sckdlp\",\"recoveryHealthDescription\":\"zrcxfailcfxwmdbo\",\"synchronizationHealthDescription\":\"fgsftufqob\",\"connectedStateDescription\":\"lnacgcc\",\"lastConnectErrorDescription\":\"nhxk\",\"lastConnectErrorTimestamp\":\"2021-03-12T19:47:17Z\"}") + .toObject(AvailabilityGroupState.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvailabilityGroupState model = new AvailabilityGroupState(); + model = BinaryData.fromObject(model).toObject(AvailabilityGroupState.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BackgroundJobTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BackgroundJobTests.java new file mode 100644 index 000000000000..82022cb778c7 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BackgroundJobTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.BackgroundJob; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class BackgroundJobTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackgroundJob model = BinaryData.fromString( + "{\"state\":\"Disabled\",\"executionState\":\"Running\",\"startTime\":\"2021-04-26T07:38:56Z\",\"endTime\":\"2021-11-11T00:37:26Z\",\"lastExecutionStatus\":\"Failed\",\"lastExecutionTime\":\"2021-02-23T21:07:30Z\",\"nextExecutionTime\":\"2021-11-17T12:16:59Z\"}") + .toObject(BackgroundJob.class); + Assertions.assertEquals(State.DISABLED, model.state()); + Assertions.assertEquals(ExecutionState.RUNNING, model.executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-26T07:38:56Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-11T00:37:26Z"), model.endTime()); + Assertions.assertEquals(LastExecutionStatus.FAILED, model.lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-23T21:07:30Z"), model.lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-17T12:16:59Z"), model.nextExecutionTime()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BackupPolicyTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BackupPolicyTests.java new file mode 100644 index 000000000000..c9e4d2ea84b5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BackupPolicyTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import org.junit.jupiter.api.Assertions; + +public final class BackupPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackupPolicy model = BinaryData.fromString( + "{\"retentionPeriodDays\":600405260,\"fullBackupDays\":945771375,\"differentialBackupHours\":24,\"transactionLogBackupMinutes\":1856462665}") + .toObject(BackupPolicy.class); + Assertions.assertEquals(600405260, model.retentionPeriodDays()); + Assertions.assertEquals(945771375, model.fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWENTY_FOUR, model.differentialBackupHours()); + Assertions.assertEquals(1856462665, model.transactionLogBackupMinutes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BackupPolicy model = new BackupPolicy().withRetentionPeriodDays(600405260) + .withFullBackupDays(945771375) + .withDifferentialBackupHours(DifferentialBackupHours.TWENTY_FOUR) + .withTransactionLogBackupMinutes(1856462665); + model = BinaryData.fromObject(model).toObject(BackupPolicy.class); + Assertions.assertEquals(600405260, model.retentionPeriodDays()); + Assertions.assertEquals(945771375, model.fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWENTY_FOUR, model.differentialBackupHours()); + Assertions.assertEquals(1856462665, model.transactionLogBackupMinutes()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BestPracticesAssessmentTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BestPracticesAssessmentTests.java new file mode 100644 index 000000000000..4c1cea8f7a25 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/BestPracticesAssessmentTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.BestPracticesAssessment; +import com.azure.resourcemanager.azurearcdata.models.CronTrigger; +import com.azure.resourcemanager.azurearcdata.models.Schedule; +import org.junit.jupiter.api.Assertions; + +public final class BestPracticesAssessmentTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BestPracticesAssessment model = BinaryData.fromString( + "{\"enabled\":false,\"schedule\":{\"enabled\":true,\"cronTrigger\":{\"startTime\":\"otllxdyhgsyo\",\"timeZone\":\"gjltdtbnnhado\",\"expression\":\"rkvcikhnvpa\"}}}") + .toObject(BestPracticesAssessment.class); + Assertions.assertFalse(model.enabled()); + Assertions.assertTrue(model.schedule().enabled()); + Assertions.assertEquals("otllxdyhgsyo", model.schedule().cronTrigger().startTime()); + Assertions.assertEquals("gjltdtbnnhado", model.schedule().cronTrigger().timeZone()); + Assertions.assertEquals("rkvcikhnvpa", model.schedule().cronTrigger().expression()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BestPracticesAssessment model = new BestPracticesAssessment().withEnabled(false) + .withSchedule(new Schedule().withEnabled(true) + .withCronTrigger(new CronTrigger().withStartTime("otllxdyhgsyo") + .withTimeZone("gjltdtbnnhado") + .withExpression("rkvcikhnvpa"))); + model = BinaryData.fromObject(model).toObject(BestPracticesAssessment.class); + Assertions.assertFalse(model.enabled()); + Assertions.assertTrue(model.schedule().enabled()); + Assertions.assertEquals("otllxdyhgsyo", model.schedule().cronTrigger().startTime()); + Assertions.assertEquals("gjltdtbnnhado", model.schedule().cronTrigger().timeZone()); + Assertions.assertEquals("rkvcikhnvpa", model.schedule().cronTrigger().expression()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ClientConnectionTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ClientConnectionTests.java new file mode 100644 index 000000000000..0ac0e168c3d1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ClientConnectionTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ClientConnection; +import org.junit.jupiter.api.Assertions; + +public final class ClientConnectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ClientConnection model = BinaryData.fromString("{\"enabled\":true}").toObject(ClientConnection.class); + Assertions.assertTrue(model.enabled()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ClientConnection model = new ClientConnection().withEnabled(true); + model = BinaryData.fromObject(model).toObject(ClientConnection.class); + Assertions.assertTrue(model.enabled()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CommonSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CommonSkuTests.java new file mode 100644 index 000000000000..cf9931650d6d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CommonSkuTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.CommonSku; +import org.junit.jupiter.api.Assertions; + +public final class CommonSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommonSku model = BinaryData.fromString( + "{\"name\":\"pasccbi\",\"dev\":true,\"size\":\"dlyjdf\",\"family\":\"mkyoqufdvruzsl\",\"capacity\":15628056}") + .toObject(CommonSku.class); + Assertions.assertEquals("pasccbi", model.name()); + Assertions.assertTrue(model.dev()); + Assertions.assertEquals("dlyjdf", model.size()); + Assertions.assertEquals("mkyoqufdvruzsl", model.family()); + Assertions.assertEquals(15628056, model.capacity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommonSku model = new CommonSku().withName("pasccbi") + .withDev(true) + .withSize("dlyjdf") + .withFamily("mkyoqufdvruzsl") + .withCapacity(15628056); + model = BinaryData.fromObject(model).toObject(CommonSku.class); + Assertions.assertEquals("pasccbi", model.name()); + Assertions.assertTrue(model.dev()); + Assertions.assertEquals("dlyjdf", model.size()); + Assertions.assertEquals("mkyoqufdvruzsl", model.family()); + Assertions.assertEquals(15628056, model.capacity()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CostOptionSelectedValuesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CostOptionSelectedValuesTests.java new file mode 100644 index 000000000000..5726d05598e8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CostOptionSelectedValuesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.CostOptionSelectedValues; +import org.junit.jupiter.api.Assertions; + +public final class CostOptionSelectedValuesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CostOptionSelectedValues model = BinaryData.fromString( + "{\"computeAndStorageCostOption\":\"sjyofdx\",\"sqlLicenseCostOption\":\"us\",\"windowsLicenseCostOption\":\"touwaboekqv\"}") + .toObject(CostOptionSelectedValues.class); + Assertions.assertEquals("sjyofdx", model.computeAndStorageCostOption()); + Assertions.assertEquals("us", model.sqlLicenseCostOption()); + Assertions.assertEquals("touwaboekqv", model.windowsLicenseCostOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CostOptionSelectedValues model = new CostOptionSelectedValues().withComputeAndStorageCostOption("sjyofdx") + .withSqlLicenseCostOption("us") + .withWindowsLicenseCostOption("touwaboekqv"); + model = BinaryData.fromObject(model).toObject(CostOptionSelectedValues.class); + Assertions.assertEquals("sjyofdx", model.computeAndStorageCostOption()); + Assertions.assertEquals("us", model.sqlLicenseCostOption()); + Assertions.assertEquals("touwaboekqv", model.windowsLicenseCostOption()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CostTypeValuesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CostTypeValuesTests.java new file mode 100644 index 000000000000..19124210b077 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CostTypeValuesTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.CostTypeValues; +import org.junit.jupiter.api.Assertions; + +public final class CostTypeValuesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CostTypeValues model = BinaryData.fromString( + "{\"computeCost\":49.63489418049941,\"storageCost\":11.064503478260335,\"iopsCost\":26.217415829732616}") + .toObject(CostTypeValues.class); + Assertions.assertEquals(49.63489418049941D, model.computeCost()); + Assertions.assertEquals(11.064503478260335D, model.storageCost()); + Assertions.assertEquals(26.217415829732616D, model.iopsCost()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CronTriggerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CronTriggerTests.java new file mode 100644 index 000000000000..db9ccb138cec --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/CronTriggerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.CronTrigger; +import org.junit.jupiter.api.Assertions; + +public final class CronTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CronTrigger model + = BinaryData.fromString("{\"startTime\":\"elwuipi\",\"timeZone\":\"jzkzi\",\"expression\":\"vvcnayr\"}") + .toObject(CronTrigger.class); + Assertions.assertEquals("elwuipi", model.startTime()); + Assertions.assertEquals("jzkzi", model.timeZone()); + Assertions.assertEquals("vvcnayr", model.expression()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CronTrigger model = new CronTrigger().withStartTime("elwuipi").withTimeZone("jzkzi").withExpression("vvcnayr"); + model = BinaryData.fromObject(model).toObject(CronTrigger.class); + Assertions.assertEquals("elwuipi", model.startTime()); + Assertions.assertEquals("jzkzi", model.timeZone()); + Assertions.assertEquals("vvcnayr", model.expression()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DBMEndpointTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DBMEndpointTests.java new file mode 100644 index 000000000000..acac24eeacb9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DBMEndpointTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.DBMEndpoint; + +public final class DBMEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DBMEndpoint model = BinaryData.fromString( + "{\"endpointName\":\"rbirphxe\",\"role\":\"NONE\",\"isEncryptionEnabled\":false,\"encryptionAlgorithm\":\"AES\",\"connectionAuth\":\"Certificate_Windows_NTLM\",\"port\":1999582411,\"isDynamicPort\":false,\"ipAddress\":\"j\",\"certificateName\":\"ujqgidok\",\"certificateExpiryDate\":\"2021-09-28T11:40:31Z\"}") + .toObject(DBMEndpoint.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DBMEndpoint model = new DBMEndpoint(); + model = BinaryData.fromObject(model).toObject(DBMEndpoint.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java deleted file mode 100644 index 9b80a3407294..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllerUpdateTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.DataControllerUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DataControllerUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DataControllerUpdate model - = BinaryData.fromString("{\"tags\":{\"wrtz\":\"oayqc\",\"ngmtsavjcb\":\"uzgwyzmhtx\"}}") - .toObject(DataControllerUpdate.class); - Assertions.assertEquals("oayqc", model.tags().get("wrtz")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DataControllerUpdate model - = new DataControllerUpdate().withTags(mapOf("wrtz", "oayqc", "ngmtsavjcb", "uzgwyzmhtx")); - model = BinaryData.fromObject(model).toObject(DataControllerUpdate.class); - Assertions.assertEquals("oayqc", model.tags().get("wrtz")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java index 0fae510add73..efce78341c5d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DataControllersDeleteMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDelete() throws Exception { AzureArcDataManager manager = AzureArcDataManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - manager.dataControllers().delete("qoaxoruzfgs", "uyfxrxxleptramxj", com.azure.core.util.Context.NONE); + manager.dataControllers().delete("uzbuwvorbalkjnbk", "dhlltqstqkqsyg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DatabaseAssessmentsItemTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DatabaseAssessmentsItemTests.java new file mode 100644 index 000000000000..e40f945152ea --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DatabaseAssessmentsItemTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.DatabaseAssessmentsItem; +import org.junit.jupiter.api.Assertions; + +public final class DatabaseAssessmentsItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseAssessmentsItem model = BinaryData.fromString( + "{\"appliesToMigrationTargetPlatform\":\"zzydmxzjijpvua\",\"featureId\":\"kihcirlde\",\"issueCategory\":\"rdcoxnbkkj\",\"moreInformation\":\"urnnqbnqbpiz\"}") + .toObject(DatabaseAssessmentsItem.class); + Assertions.assertEquals("zzydmxzjijpvua", model.appliesToMigrationTargetPlatform()); + Assertions.assertEquals("kihcirlde", model.featureId()); + Assertions.assertEquals("rdcoxnbkkj", model.issueCategory()); + Assertions.assertEquals("urnnqbnqbpiz", model.moreInformation()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DatabasesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DatabasesTests.java new file mode 100644 index 000000000000..63b2f64aba1d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DatabasesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DatabasesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Databases model = BinaryData.fromString("{\"values\":[\"jnhgwydyyn\",\"svkhgbv\",\"ta\",\"arfdlpukhpyrnei\"]}") + .toObject(Databases.class); + Assertions.assertEquals("jnhgwydyyn", model.values().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Databases model = new Databases().withValues(Arrays.asList("jnhgwydyyn", "svkhgbv", "ta", "arfdlpukhpyrnei")); + model = BinaryData.fromObject(model).toObject(Databases.class); + Assertions.assertEquals("jnhgwydyyn", model.values().get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DiskSizesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DiskSizesTests.java new file mode 100644 index 000000000000..c4339e864dc6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DiskSizesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.DiskSizes; +import org.junit.jupiter.api.Assertions; + +public final class DiskSizesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiskSizes model = BinaryData.fromString( + "{\"diskType\":\"dreqnovvqf\",\"redundancy\":\"ljxywsu\",\"size\":\"yrs\",\"caching\":\"sytgadgvraea\",\"maxSizeInGib\":2.1020076819004196,\"maxThroughputInMbps\":13.879983784209282,\"maxIops\":29.371294044584296}") + .toObject(DiskSizes.class); + Assertions.assertEquals("dreqnovvqf", model.diskType()); + Assertions.assertEquals("ljxywsu", model.redundancy()); + Assertions.assertEquals("yrs", model.size()); + Assertions.assertEquals("sytgadgvraea", model.caching()); + Assertions.assertEquals(2.1020076819004196D, model.maxSizeInGib()); + Assertions.assertEquals(13.879983784209282D, model.maxThroughputInMbps()); + Assertions.assertEquals(29.371294044584296D, model.maxIops()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfigurationTests.java new file mode 100644 index 000000000000..2e3b5a7bf93c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfigurationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration model + = BinaryData.fromString("{\"certificateName\":\"nnbsoqeqa\"}") + .toObject(DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.class); + Assertions.assertEquals("nnbsoqeqa", model.certificateName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration model + = new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("nnbsoqeqa"); + model = BinaryData.fromObject(model) + .toObject(DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration.class); + Assertions.assertEquals("nnbsoqeqa", model.certificateName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfigurationTests.java new file mode 100644 index 000000000000..6b38cc0998fc --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfigurationTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import org.junit.jupiter.api.Assertions; + +public final class DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration model = BinaryData.fromString( + "{\"availabilityGroup\":\"rxuzvoam\",\"listenerUrl\":\"cqiosmgbza\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"failoverMode\":\"AUTOMATIC\",\"seedingMode\":\"MANUAL\",\"certificateConfiguration\":{\"certificateName\":\"ltlaprltzkatbhj\"}}") + .toObject(DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.class); + Assertions.assertEquals("rxuzvoam", model.availabilityGroup()); + Assertions.assertEquals("cqiosmgbza", model.listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, model.availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, model.failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, model.seedingMode()); + Assertions.assertEquals("ltlaprltzkatbhj", model.certificateConfiguration().certificateName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration model + = new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("rxuzvoam") + .withListenerUrl("cqiosmgbza") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.MANUAL) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("ltlaprltzkatbhj")); + model = BinaryData.fromObject(model) + .toObject(DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration.class); + Assertions.assertEquals("rxuzvoam", model.availabilityGroup()); + Assertions.assertEquals("cqiosmgbza", model.listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, model.availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, model.failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, model.seedingMode()); + Assertions.assertEquals("ltlaprltzkatbhj", model.certificateConfiguration().certificateName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateConfigurationTests.java new file mode 100644 index 000000000000..14b3277c2623 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/DistributedAvailabilityGroupCreateUpdateConfigurationTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import org.junit.jupiter.api.Assertions; + +public final class DistributedAvailabilityGroupCreateUpdateConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DistributedAvailabilityGroupCreateUpdateConfiguration model = BinaryData.fromString( + "{\"availabilityGroupName\":\"oatftgzpnpbswvef\",\"primaryAvailabilityGroup\":{\"availabilityGroup\":\"cs\",\"listenerUrl\":\"ozihmipgawt\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"failoverMode\":\"AUTOMATIC\",\"seedingMode\":\"AUTOMATIC\",\"certificateConfiguration\":{\"certificateName\":\"jxgrytfmp\"}},\"secondaryAvailabilityGroup\":{\"availabilityGroup\":\"ilrmcaykggnox\",\"listenerUrl\":\"t\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"failoverMode\":\"AUTOMATIC\",\"seedingMode\":\"AUTOMATIC\",\"certificateConfiguration\":{\"certificateName\":\"cpfnznthjtwkja\"}}}") + .toObject(DistributedAvailabilityGroupCreateUpdateConfiguration.class); + Assertions.assertEquals("oatftgzpnpbswvef", model.availabilityGroupName()); + Assertions.assertEquals("cs", model.primaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("ozihmipgawt", model.primaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.primaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, model.primaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.primaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("jxgrytfmp", + model.primaryAvailabilityGroup().certificateConfiguration().certificateName()); + Assertions.assertEquals("ilrmcaykggnox", model.secondaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("t", model.secondaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.secondaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, model.secondaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.secondaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("cpfnznthjtwkja", + model.secondaryAvailabilityGroup().certificateConfiguration().certificateName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DistributedAvailabilityGroupCreateUpdateConfiguration model + = new DistributedAvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("oatftgzpnpbswvef") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("cs") + .withListenerUrl("ozihmipgawt") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("jxgrytfmp"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("ilrmcaykggnox") + .withListenerUrl("t") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("cpfnznthjtwkja"))); + model = BinaryData.fromObject(model).toObject(DistributedAvailabilityGroupCreateUpdateConfiguration.class); + Assertions.assertEquals("oatftgzpnpbswvef", model.availabilityGroupName()); + Assertions.assertEquals("cs", model.primaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("ozihmipgawt", model.primaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.primaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, model.primaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.primaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("jxgrytfmp", + model.primaryAvailabilityGroup().certificateConfiguration().certificateName()); + Assertions.assertEquals("ilrmcaykggnox", model.secondaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("t", model.secondaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.secondaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, model.secondaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.secondaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("cpfnznthjtwkja", + model.secondaryAvailabilityGroup().certificateConfiguration().certificateName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/EntraAuthenticationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/EntraAuthenticationTests.java new file mode 100644 index 000000000000..4d37c755c710 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/EntraAuthenticationTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.EntraAuthentication; +import com.azure.resourcemanager.azurearcdata.models.IdentityType; +import org.junit.jupiter.api.Assertions; + +public final class EntraAuthenticationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EntraAuthentication model = BinaryData + .fromString("{\"identityType\":\"SystemAssignedManagedIdentity\",\"clientId\":\"ukghimdblxgw\"}") + .toObject(EntraAuthentication.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED_MANAGED_IDENTITY, model.identityType()); + Assertions.assertEquals("ukghimdblxgw", model.clientId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EntraAuthentication model + = new EntraAuthentication().withIdentityType(IdentityType.SYSTEM_ASSIGNED_MANAGED_IDENTITY) + .withClientId("ukghimdblxgw"); + model = BinaryData.fromObject(model).toObject(EntraAuthentication.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED_MANAGED_IDENTITY, model.identityType()); + Assertions.assertEquals("ukghimdblxgw", model.clientId()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java index f0239f9ac65e..da5f4058eede 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ExtendedLocationTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -12,18 +12,17 @@ public final class ExtendedLocationTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ExtendedLocation model = BinaryData.fromString("{\"name\":\"zoqftiyqzrnkcqvy\",\"type\":\"CustomLocation\"}") - .toObject(ExtendedLocation.class); - Assertions.assertEquals("zoqftiyqzrnkcqvy", model.name()); + ExtendedLocation model + = BinaryData.fromString("{\"name\":\"n\",\"type\":\"CustomLocation\"}").toObject(ExtendedLocation.class); + Assertions.assertEquals("n", model.name()); Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ExtendedLocation model - = new ExtendedLocation().withName("zoqftiyqzrnkcqvy").withType(ExtendedLocationTypes.CUSTOM_LOCATION); + ExtendedLocation model = new ExtendedLocation().withName("n").withType(ExtendedLocationTypes.CUSTOM_LOCATION); model = BinaryData.fromObject(model).toObject(ExtendedLocation.class); - Assertions.assertEquals("zoqftiyqzrnkcqvy", model.name()); + Assertions.assertEquals("n", model.name()); Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.type()); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverClusterTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverClusterTests.java new file mode 100644 index 000000000000..40151ac68829 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverClusterTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.FailoverCluster; + +public final class FailoverClusterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverCluster model = BinaryData.fromString( + "{\"id\":\"yoxgvcltbgsnc\",\"networkName\":\"kjeszz\",\"sqlInstanceIds\":[\"jhtxfvgxbfsmxne\",\"mpvecxgodebfqk\"],\"hostNames\":[\"mpukgriw\",\"lzlfbxzpuz\",\"cispnqzahmgkbr\"],\"hostIPAddresses\":[{\"ipAddress\":\"hibnuqqkpika\",\"subnetMask\":\"gvtqagnbuynh\"}]}") + .toObject(FailoverCluster.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverCluster model = new FailoverCluster(); + model = BinaryData.fromObject(model).toObject(FailoverCluster.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupListResultTests.java new file mode 100644 index 000000000000..30570614780c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupListResultTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.FailoverGroupListResult; + +public final class FailoverGroupListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverGroupListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"partnerManagedInstanceId\":\"wtswbzuwfmdur\",\"spec\":{\"sharedName\":\"egizv\",\"sourceMI\":\"felisdjub\",\"partnerMI\":\"bqigkx\",\"partnerMirroringURL\":\"sazgakgacyrcmj\",\"partnerMirroringCert\":\"spofapvuhry\",\"partnerSyncMode\":\"sync\",\"role\":\"secondary\",\"jed\":\"\\\"datazgb\\\"\"},\"status\":\"\\\"datatkvnlvxbcuiiznkt\\\"\",\"bmikost\":\"\\\"datansnvpd\\\"\",\"kiwbuqnyoph\":\"\\\"dataz\\\"\"},\"id\":\"yls\",\"name\":\"crpfbcunez\",\"type\":\"cez\"}],\"nextLink\":\"fwyfwlwxjwet\"}") + .toObject(FailoverGroupListResult.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupPropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupPropertiesTests.java new file mode 100644 index 000000000000..ac87af177a4c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupPropertiesTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FailoverGroupPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverGroupProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Succeeded\",\"partnerManagedInstanceId\":\"zhraglkafh\",\"spec\":{\"sharedName\":\"qjujeickpzvcp\",\"sourceMI\":\"mxelnwcltyjed\",\"partnerMI\":\"xm\",\"partnerMirroringURL\":\"mkqscaz\",\"partnerMirroringCert\":\"wxtzxpuamwab\",\"partnerSyncMode\":\"async\",\"role\":\"force-secondary\",\"aivmxyasflvgs\":\"\\\"dataushsp\\\"\"},\"status\":\"\\\"datawywa\\\"\",\"ljhlnymzotq\":\"\\\"datahknsmjbl\\\"\",\"mv\":\"\\\"dataryuzcbmqqv\\\"\",\"ujlzqnhcvsqltn\":\"\\\"datafgtayxonsup\\\"\"}") + .toObject(FailoverGroupProperties.class); + Assertions.assertEquals("zhraglkafh", model.partnerManagedInstanceId()); + Assertions.assertEquals("qjujeickpzvcp", model.spec().sharedName()); + Assertions.assertEquals("mxelnwcltyjed", model.spec().sourceMI()); + Assertions.assertEquals("xm", model.spec().partnerMI()); + Assertions.assertEquals("mkqscaz", model.spec().partnerMirroringUrl()); + Assertions.assertEquals("wxtzxpuamwab", model.spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, model.spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.FORCE_SECONDARY, model.spec().role()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverGroupProperties model = new FailoverGroupProperties().withPartnerManagedInstanceId("zhraglkafh") + .withSpec(new FailoverGroupSpec().withSharedName("qjujeickpzvcp") + .withSourceMI("mxelnwcltyjed") + .withPartnerMI("xm") + .withPartnerMirroringUrl("mkqscaz") + .withPartnerMirroringCert("wxtzxpuamwab") + .withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.FORCE_SECONDARY) + .withAdditionalProperties(mapOf("aivmxyasflvgs", "\"dataushsp\""))) + .withStatus("\"datawywa\"") + .withAdditionalProperties(mapOf("ljhlnymzotq", "\"datahknsmjbl\"", "mv", "\"dataryuzcbmqqv\"", + "ujlzqnhcvsqltn", "\"datafgtayxonsup\"", "provisioningState", "Succeeded")); + model = BinaryData.fromObject(model).toObject(FailoverGroupProperties.class); + Assertions.assertEquals("zhraglkafh", model.partnerManagedInstanceId()); + Assertions.assertEquals("qjujeickpzvcp", model.spec().sharedName()); + Assertions.assertEquals("mxelnwcltyjed", model.spec().sourceMI()); + Assertions.assertEquals("xm", model.spec().partnerMI()); + Assertions.assertEquals("mkqscaz", model.spec().partnerMirroringUrl()); + Assertions.assertEquals("wxtzxpuamwab", model.spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, model.spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.FORCE_SECONDARY, model.spec().role()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupResourceInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupResourceInnerTests.java new file mode 100644 index 000000000000..6108a3b46438 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupResourceInnerTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.FailoverGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FailoverGroupResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverGroupResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Failed\",\"partnerManagedInstanceId\":\"jg\",\"spec\":{\"sharedName\":\"exaoguya\",\"sourceMI\":\"ids\",\"partnerMI\":\"ultxijjumfq\",\"partnerMirroringURL\":\"z\",\"partnerMirroringCert\":\"qnmcjngzqdqx\",\"partnerSyncMode\":\"async\",\"role\":\"force-secondary\",\"fzsvtuikzh\":\"\\\"datayfu\\\"\",\"cfhmlrqryxyn\":\"\\\"datajqg\\\"\",\"ptgoeiybbabp\":\"\\\"datanzrdpsovwxz\\\"\",\"slkvntjl\":\"\\\"datahv\\\"\"},\"status\":\"\\\"datagjkskyrioov\\\"\",\"frygznmmax\":\"\\\"datasxwaabzm\\\"\",\"xlhslnel\":\"\\\"dataizkzobgo\\\"\"},\"id\":\"eixynllxecwcroj\",\"name\":\"hslhca\",\"type\":\"jutifdwfmvigorqj\"}") + .toObject(FailoverGroupResourceInner.class); + Assertions.assertEquals("jg", model.properties().partnerManagedInstanceId()); + Assertions.assertEquals("exaoguya", model.properties().spec().sharedName()); + Assertions.assertEquals("ids", model.properties().spec().sourceMI()); + Assertions.assertEquals("ultxijjumfq", model.properties().spec().partnerMI()); + Assertions.assertEquals("z", model.properties().spec().partnerMirroringUrl()); + Assertions.assertEquals("qnmcjngzqdqx", model.properties().spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, model.properties().spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.FORCE_SECONDARY, model.properties().spec().role()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverGroupResourceInner model = new FailoverGroupResourceInner() + .withProperties(new FailoverGroupProperties().withPartnerManagedInstanceId("jg") + .withSpec(new FailoverGroupSpec().withSharedName("exaoguya") + .withSourceMI("ids") + .withPartnerMI("ultxijjumfq") + .withPartnerMirroringUrl("z") + .withPartnerMirroringCert("qnmcjngzqdqx") + .withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.FORCE_SECONDARY) + .withAdditionalProperties(mapOf("cfhmlrqryxyn", "\"datajqg\"", "fzsvtuikzh", "\"datayfu\"", + "ptgoeiybbabp", "\"datanzrdpsovwxz\"", "slkvntjl", "\"datahv\""))) + .withStatus("\"datagjkskyrioov\"") + .withAdditionalProperties(mapOf("xlhslnel", "\"dataizkzobgo\"", "frygznmmax", "\"datasxwaabzm\"", + "provisioningState", "Failed"))); + model = BinaryData.fromObject(model).toObject(FailoverGroupResourceInner.class); + Assertions.assertEquals("jg", model.properties().partnerManagedInstanceId()); + Assertions.assertEquals("exaoguya", model.properties().spec().sharedName()); + Assertions.assertEquals("ids", model.properties().spec().sourceMI()); + Assertions.assertEquals("ultxijjumfq", model.properties().spec().partnerMI()); + Assertions.assertEquals("z", model.properties().spec().partnerMirroringUrl()); + Assertions.assertEquals("qnmcjngzqdqx", model.properties().spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, model.properties().spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.FORCE_SECONDARY, model.properties().spec().role()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupSpecTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupSpecTests.java new file mode 100644 index 000000000000..172b658119be --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupSpecTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FailoverGroupSpecTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverGroupSpec model = BinaryData.fromString( + "{\"sharedName\":\"ibg\",\"sourceMI\":\"gnxf\",\"partnerMI\":\"onmpqoxwdof\",\"partnerMirroringURL\":\"xiqxeiiqbimh\",\"partnerMirroringCert\":\"wwinhehf\",\"partnerSyncMode\":\"async\",\"role\":\"secondary\",\"kbwvqvxkdiv\":\"\\\"databcblemb\\\"\"}") + .toObject(FailoverGroupSpec.class); + Assertions.assertEquals("ibg", model.sharedName()); + Assertions.assertEquals("gnxf", model.sourceMI()); + Assertions.assertEquals("onmpqoxwdof", model.partnerMI()); + Assertions.assertEquals("xiqxeiiqbimh", model.partnerMirroringUrl()); + Assertions.assertEquals("wwinhehf", model.partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, model.partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.SECONDARY, model.role()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverGroupSpec model = new FailoverGroupSpec().withSharedName("ibg") + .withSourceMI("gnxf") + .withPartnerMI("onmpqoxwdof") + .withPartnerMirroringUrl("xiqxeiiqbimh") + .withPartnerMirroringCert("wwinhehf") + .withPartnerSyncMode(FailoverGroupPartnerSyncMode.ASYNC) + .withRole(InstanceFailoverGroupRole.SECONDARY) + .withAdditionalProperties(mapOf("kbwvqvxkdiv", "\"databcblemb\"")); + model = BinaryData.fromObject(model).toObject(FailoverGroupSpec.class); + Assertions.assertEquals("ibg", model.sharedName()); + Assertions.assertEquals("gnxf", model.sourceMI()); + Assertions.assertEquals("onmpqoxwdof", model.partnerMI()); + Assertions.assertEquals("xiqxeiiqbimh", model.partnerMirroringUrl()); + Assertions.assertEquals("wwinhehf", model.partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, model.partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.SECONDARY, model.role()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateMockTests.java new file mode 100644 index 000000000000..177e1fccc04c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsCreateMockTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupProperties; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupSpec; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FailoverGroupsCreateMockTests { + @Test + public void testCreate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"partnerManagedInstanceId\":\"bbprtugav\",\"spec\":{\"sharedName\":\"bcyksivmfogd\",\"sourceMI\":\"bfcmkrfts\",\"partnerMI\":\"wjjxsgm\",\"partnerMirroringURL\":\"wvif\",\"partnerMirroringCert\":\"kecifhocjxwklo\",\"partnerSyncMode\":\"sync\",\"role\":\"force-primary-allow-data-loss\",\"nlcpxxviry\":\"\\\"datavcmuf\\\"\",\"crdcueljti\":\"\\\"datayngjgvrquvpygglp\\\"\",\"lcjkayspthzodub\":\"\\\"datahxmfqryarvsxzqb\\\"\"},\"status\":\"\\\"datamjtgblioskkfmkm\\\"\",\"cteoedlrslsk\":\"\\\"dataxyxgbkkqv\\\"\",\"jhpcn\":\"\\\"datazpxvjnzdpvoc\\\"\"},\"id\":\"xzfsnggytexvzilm\",\"name\":\"iv\",\"type\":\"kwwwnckn\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FailoverGroupResource response = manager.failoverGroups() + .define("vczuodacpune") + .withExistingSqlManagedInstance("ly", "cgxvrpj") + .withProperties(new FailoverGroupProperties().withPartnerManagedInstanceId("pdjxqeskoynu") + .withSpec(new FailoverGroupSpec().withSharedName("lpckaewsedves") + .withSourceMI("xegqphr") + .withPartnerMI("nzhctmjtsgh") + .withPartnerMirroringUrl("c") + .withPartnerMirroringCert("pzarpzeqacdld") + .withPartnerSyncMode(FailoverGroupPartnerSyncMode.SYNC) + .withRole(InstanceFailoverGroupRole.FORCE_SECONDARY) + .withAdditionalProperties( + mapOf("qndaizupfkhuytus", "\"dataefcpczshn\"", "tvegwqiukvzwy", "\"dataxhmt\""))) + .withStatus("\"datatthaokgkskj\"") + .withAdditionalProperties(mapOf("provisioningState", "Canceled", "pgeumilh", "\"datasshajqfukpee\""))) + .create(); + + Assertions.assertEquals("bbprtugav", response.properties().partnerManagedInstanceId()); + Assertions.assertEquals("bcyksivmfogd", response.properties().spec().sharedName()); + Assertions.assertEquals("bfcmkrfts", response.properties().spec().sourceMI()); + Assertions.assertEquals("wjjxsgm", response.properties().spec().partnerMI()); + Assertions.assertEquals("wvif", response.properties().spec().partnerMirroringUrl()); + Assertions.assertEquals("kecifhocjxwklo", response.properties().spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.SYNC, response.properties().spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.FORCE_PRIMARY_ALLOW_DATA_LOSS, + response.properties().spec().role()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteMockTests.java new file mode 100644 index 000000000000..b85b8507caeb --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FailoverGroupsDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.failoverGroups().delete("efgnaavuagnt", "taoutnpdct", "hspfefyihd", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetWithResponseMockTests.java new file mode 100644 index 000000000000..6151e14facfd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsGetWithResponseMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FailoverGroupsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Canceled\",\"partnerManagedInstanceId\":\"s\",\"spec\":{\"sharedName\":\"h\",\"sourceMI\":\"ddacbcbgydlqidy\",\"partnerMI\":\"hmptyrilkfbn\",\"partnerMirroringURL\":\"qxvztpbnfnqtxjt\",\"partnerMirroringCert\":\"alswbnfd\",\"partnerSyncMode\":\"async\",\"role\":\"primary\",\"f\":\"\\\"dataqjn\\\"\",\"vmywhsbrcarycsjj\":\"\\\"dataygleexa\\\"\",\"dmkrrb\":\"\\\"datayvoaqajuvehzp\\\"\",\"ubefgybpmfbfunu\":\"\\\"datampfu\\\"\"},\"status\":\"\\\"datapzkrvfy\\\"\",\"cwnphbkgfyrtogm\":\"\\\"datadschlzvfictnkjjw\\\"\",\"ev\":\"\\\"datamjpjscdfpdqwty\\\"\",\"x\":\"\\\"datawmseharxifvqn\\\"\",\"sidqpxlbtpakft\":\"\\\"datambpjptnvwjh\\\"\"},\"id\":\"atw\",\"name\":\"ykyutrymdwmfj\",\"type\":\"pycvjqdvdwkqpldr\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FailoverGroupResource response = manager.failoverGroups() + .getWithResponse("dtfohfaog", "vkiwrsiwdyjqu", "ykcrraue", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("s", response.properties().partnerManagedInstanceId()); + Assertions.assertEquals("h", response.properties().spec().sharedName()); + Assertions.assertEquals("ddacbcbgydlqidy", response.properties().spec().sourceMI()); + Assertions.assertEquals("hmptyrilkfbn", response.properties().spec().partnerMI()); + Assertions.assertEquals("qxvztpbnfnqtxjt", response.properties().spec().partnerMirroringUrl()); + Assertions.assertEquals("alswbnfd", response.properties().spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, response.properties().spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.PRIMARY, response.properties().spec().role()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListMockTests.java new file mode 100644 index 000000000000..df0be8a6d7ac --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverGroupsListMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupPartnerSyncMode; +import com.azure.resourcemanager.azurearcdata.models.FailoverGroupResource; +import com.azure.resourcemanager.azurearcdata.models.InstanceFailoverGroupRole; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FailoverGroupsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"partnerManagedInstanceId\":\"hllnmwynefxe\",\"spec\":{\"sharedName\":\"fciatxtjrr\",\"sourceMI\":\"mdskjhhxdlajfoxc\",\"partnerMI\":\"cvslxlhuavkrmukm\",\"partnerMirroringURL\":\"mkxettcsloj\",\"partnerMirroringCert\":\"qid\",\"partnerSyncMode\":\"async\",\"role\":\"primary\",\"qhtkbt\":\"\\\"datajhqxc\\\"\",\"ld\":\"\\\"dataqlrn\\\"\",\"hllxricctkw\":\"\\\"databiipsnawwlqkznx\\\"\"},\"status\":\"\\\"dataqqoajxeiyglesrw\\\"\",\"rupobehd\":\"\\\"dataxhdctrceqnk\\\"\"},\"id\":\"jzacvumepjpbibn\",\"name\":\"pphepifexl\",\"type\":\"qirccj\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.failoverGroups().list("yeuyldph", "tybkcgs", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hllnmwynefxe", response.iterator().next().properties().partnerManagedInstanceId()); + Assertions.assertEquals("fciatxtjrr", response.iterator().next().properties().spec().sharedName()); + Assertions.assertEquals("mdskjhhxdlajfoxc", response.iterator().next().properties().spec().sourceMI()); + Assertions.assertEquals("cvslxlhuavkrmukm", response.iterator().next().properties().spec().partnerMI()); + Assertions.assertEquals("mkxettcsloj", response.iterator().next().properties().spec().partnerMirroringUrl()); + Assertions.assertEquals("qid", response.iterator().next().properties().spec().partnerMirroringCert()); + Assertions.assertEquals(FailoverGroupPartnerSyncMode.ASYNC, + response.iterator().next().properties().spec().partnerSyncMode()); + Assertions.assertEquals(InstanceFailoverGroupRole.PRIMARY, + response.iterator().next().properties().spec().role()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverMiLinkResourceIdTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverMiLinkResourceIdTests.java new file mode 100644 index 000000000000..b39b4fb88948 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/FailoverMiLinkResourceIdTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; +import org.junit.jupiter.api.Assertions; + +public final class FailoverMiLinkResourceIdTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverMiLinkResourceId model + = BinaryData.fromString("{\"managedInstanceId\":\"cpeogkhnmgbrou\",\"force\":false}") + .toObject(FailoverMiLinkResourceId.class); + Assertions.assertEquals("cpeogkhnmgbrou", model.managedInstanceId()); + Assertions.assertFalse(model.force()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverMiLinkResourceId model + = new FailoverMiLinkResourceId().withManagedInstanceId("cpeogkhnmgbrou").withForce(false); + model = BinaryData.fromObject(model).toObject(FailoverMiLinkResourceId.class); + Assertions.assertEquals("cpeogkhnmgbrou", model.managedInstanceId()); + Assertions.assertFalse(model.force()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/HostIPAddressInformationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/HostIPAddressInformationTests.java new file mode 100644 index 000000000000..b984b4aa1e17 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/HostIPAddressInformationTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.HostIPAddressInformation; + +public final class HostIPAddressInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HostIPAddressInformation model = BinaryData.fromString("{\"ipAddress\":\"gg\",\"subnetMask\":\"bfs\"}") + .toObject(HostIPAddressInformation.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ImpactedObjectsInfoTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ImpactedObjectsInfoTests.java new file mode 100644 index 000000000000..fb7a17346c1e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ImpactedObjectsInfoTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ImpactedObjectsInfo; +import org.junit.jupiter.api.Assertions; + +public final class ImpactedObjectsInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpactedObjectsInfo model = BinaryData + .fromString("{\"featureId\":\"iknsorgjh\",\"numberImpacted\":1755128806,\"issueCategory\":\"tlwwrlk\"}") + .toObject(ImpactedObjectsInfo.class); + Assertions.assertEquals("iknsorgjh", model.featureId()); + Assertions.assertEquals(1755128806, model.numberImpacted()); + Assertions.assertEquals("tlwwrlk", model.issueCategory()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ImpactedObjectsSuitabilitySummaryTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ImpactedObjectsSuitabilitySummaryTests.java new file mode 100644 index 000000000000..789d00afd4ba --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ImpactedObjectsSuitabilitySummaryTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ImpactedObjectsSuitabilitySummary; + +public final class ImpactedObjectsSuitabilitySummaryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpactedObjectsSuitabilitySummary model = BinaryData.fromString( + "{\"azureSqlDatabase\":[{\"featureId\":\"uijfqk\",\"numberImpacted\":216133532,\"issueCategory\":\"iipfpubj\"}],\"azureSqlManagedInstance\":[{\"featureId\":\"iftohqkvpu\",\"numberImpacted\":2123821408,\"issueCategory\":\"plsaknynfsynljph\"},{\"featureId\":\"pxodlqiyntorzih\",\"numberImpacted\":1679809360,\"issueCategory\":\"jswsrmslyz\"},{\"featureId\":\"zbchckqqzqioxiy\",\"numberImpacted\":1721034864,\"issueCategory\":\"zynkedya\"},{\"featureId\":\"wyhqmibzyhwits\",\"numberImpacted\":720588541,\"issueCategory\":\"ynpcdpumnzgmwznm\"}]}") + .toObject(ImpactedObjectsSuitabilitySummary.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImpactedObjectsSuitabilitySummary model = new ImpactedObjectsSuitabilitySummary(); + model = BinaryData.fromObject(model).toObject(ImpactedObjectsSuitabilitySummary.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SActiveDirectoryConnectorTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SActiveDirectoryConnectorTests.java new file mode 100644 index 000000000000..09e7f44b2722 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SActiveDirectoryConnectorTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.K8SActiveDirectoryConnector; +import org.junit.jupiter.api.Assertions; + +public final class K8SActiveDirectoryConnectorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + K8SActiveDirectoryConnector model + = BinaryData.fromString("{\"name\":\"jrefovgmkqsle\",\"namespace\":\"vxyqjpkcattpngjc\"}") + .toObject(K8SActiveDirectoryConnector.class); + Assertions.assertEquals("jrefovgmkqsle", model.name()); + Assertions.assertEquals("vxyqjpkcattpngjc", model.namespace()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + K8SActiveDirectoryConnector model + = new K8SActiveDirectoryConnector().withName("jrefovgmkqsle").withNamespace("vxyqjpkcattpngjc"); + model = BinaryData.fromObject(model).toObject(K8SActiveDirectoryConnector.class); + Assertions.assertEquals("jrefovgmkqsle", model.name()); + Assertions.assertEquals("vxyqjpkcattpngjc", model.namespace()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SNetworkSettingsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SNetworkSettingsTests.java new file mode 100644 index 000000000000..b870d668da1e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SNetworkSettingsTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings; +import org.junit.jupiter.api.Assertions; + +public final class K8SNetworkSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + K8SNetworkSettings model + = BinaryData.fromString("{\"forceencryption\":1075133602,\"tlsciphers\":\"ymddys\",\"tlsprotocols\":\"i\"}") + .toObject(K8SNetworkSettings.class); + Assertions.assertEquals(1075133602, model.forceencryption()); + Assertions.assertEquals("ymddys", model.tlsciphers()); + Assertions.assertEquals("i", model.tlsprotocols()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + K8SNetworkSettings model + = new K8SNetworkSettings().withForceencryption(1075133602).withTlsciphers("ymddys").withTlsprotocols("i"); + model = BinaryData.fromObject(model).toObject(K8SNetworkSettings.class); + Assertions.assertEquals(1075133602, model.forceencryption()); + Assertions.assertEquals("ymddys", model.tlsciphers()); + Assertions.assertEquals("i", model.tlsprotocols()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java index 3ab0a491e6fa..9ebff7784beb 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SResourceRequirementsTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -14,22 +14,21 @@ public final class K8SResourceRequirementsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { K8SResourceRequirements model = BinaryData.fromString( - "{\"requests\":{\"v\":\"eiithlvmez\",\"xwburvjxxjns\":\"hxmzsbbzoggig\",\"ou\":\"ydptkoen\"},\"limits\":{\"ngkpocipazy\":\"udwtiukbl\",\"gukgjnpiucgygevq\":\"o\",\"dpydn\":\"ntypmrbpizcdrqj\",\"sjttgzfbish\":\"yhxdeoejzicwi\"},\"\":{\"alpbuxwgipwhon\":\"datahajdeyeamdpha\"}}") + "{\"requests\":{\"jj\":\"pqyegualhbxxh\",\"ynpwlbj\":\"zvdudgwdslfhotwm\"},\"limits\":{\"ehxnltyfsop\":\"acfta\",\"nzwdejba\":\"usue\",\"xdn\":\"orxzdmohctbqvud\"},\"azjdyggd\":\"\\\"dataowgujjugwdkcglhs\\\"\"}") .toObject(K8SResourceRequirements.class); - Assertions.assertEquals("eiithlvmez", model.requests().get("v")); - Assertions.assertEquals("udwtiukbl", model.limits().get("ngkpocipazy")); + Assertions.assertEquals("pqyegualhbxxh", model.requests().get("jj")); + Assertions.assertEquals("acfta", model.limits().get("ehxnltyfsop")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - K8SResourceRequirements model = new K8SResourceRequirements() - .withRequests(mapOf("v", "eiithlvmez", "xwburvjxxjns", "hxmzsbbzoggig", "ou", "ydptkoen")) - .withLimits(mapOf("ngkpocipazy", "udwtiukbl", "gukgjnpiucgygevq", "o", "dpydn", "ntypmrbpizcdrqj", - "sjttgzfbish", "yhxdeoejzicwi")) - .withAdditionalProperties(mapOf()); + K8SResourceRequirements model + = new K8SResourceRequirements().withRequests(mapOf("jj", "pqyegualhbxxh", "ynpwlbj", "zvdudgwdslfhotwm")) + .withLimits(mapOf("ehxnltyfsop", "acfta", "nzwdejba", "usue", "xdn", "orxzdmohctbqvud")) + .withAdditionalProperties(mapOf("azjdyggd", "\"dataowgujjugwdkcglhs\"")); model = BinaryData.fromObject(model).toObject(K8SResourceRequirements.class); - Assertions.assertEquals("eiithlvmez", model.requests().get("v")); - Assertions.assertEquals("udwtiukbl", model.limits().get("ngkpocipazy")); + Assertions.assertEquals("pqyegualhbxxh", model.requests().get("jj")); + Assertions.assertEquals("acfta", model.limits().get("ehxnltyfsop")); } // Use "Map.of" if available diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java index eb361e2ff730..3bc7fa9ac5b3 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingOptionsTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -15,23 +15,27 @@ public final class K8SSchedulingOptionsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { K8SSchedulingOptions model = BinaryData.fromString( - "{\"resources\":{\"requests\":{\"i\":\"fsfksymddyst\"},\"limits\":{\"vyifqrvkdvjsl\":\"hqyudxorrqnbpoc\",\"vdfwatkpn\":\"rm\",\"wiqzbqjvsovmyo\":\"ulexxbczwtr\",\"zdobpxjmflbvvnch\":\"acspkwl\"},\"\":{\"ajiwkuo\":\"dataciwwzjuqkhr\"}},\"\":{\"sauuimj\":\"datakg\",\"rfbyaosvexcso\":\"datavxieduugidyj\",\"vleggzfbuhfmvfax\":\"datapclhocohslk\"}}") + "{\"resources\":{\"requests\":{\"gnxkrxdqmidtth\":\"kftutqxlngxlefg\",\"hjybigehoqfbo\":\"rvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\"},\"limits\":{\"fvm\":\"zgpphrcgyncocpe\",\"bmqj\":\"coofsxlzev\",\"lzu\":\"abcypmivk\",\"ebxetqgtzxdp\":\"ccfwnfnbacfion\"},\"jfeallnwsub\":\"\\\"dataqqwx\\\"\",\"zscxaqwo\":\"\\\"datasnjampmng\\\"\"},\"lrxnjeaseiphe\":\"\\\"datacbonqvpk\\\"\",\"okeyyienj\":\"\\\"dataf\\\"\",\"jumasx\":\"\\\"datadlwtgrhpdj\\\"\"}") .toObject(K8SSchedulingOptions.class); - Assertions.assertEquals("fsfksymddyst", model.resources().requests().get("i")); - Assertions.assertEquals("hqyudxorrqnbpoc", model.resources().limits().get("vyifqrvkdvjsl")); + Assertions.assertEquals("kftutqxlngxlefg", model.resources().requests().get("gnxkrxdqmidtth")); + Assertions.assertEquals("zgpphrcgyncocpe", model.resources().limits().get("fvm")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - K8SSchedulingOptions model = new K8SSchedulingOptions() - .withResources(new K8SResourceRequirements().withRequests(mapOf("i", "fsfksymddyst")) - .withLimits(mapOf("vyifqrvkdvjsl", "hqyudxorrqnbpoc", "vdfwatkpn", "rm", "wiqzbqjvsovmyo", - "ulexxbczwtr", "zdobpxjmflbvvnch", "acspkwl")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf()); + K8SSchedulingOptions model + = new K8SSchedulingOptions() + .withResources(new K8SResourceRequirements() + .withRequests(mapOf("gnxkrxdqmidtth", "kftutqxlngxlefg", "hjybigehoqfbo", "rvqdra", + "zlcuiywgqywgndrv", "skanyk")) + .withLimits(mapOf("fvm", "zgpphrcgyncocpe", "bmqj", "coofsxlzev", "lzu", "abcypmivk", + "ebxetqgtzxdp", "ccfwnfnbacfion")) + .withAdditionalProperties(mapOf("zscxaqwo", "\"datasnjampmng\"", "jfeallnwsub", "\"dataqqwx\""))) + .withAdditionalProperties(mapOf("jumasx", "\"datadlwtgrhpdj\"", "okeyyienj", "\"dataf\"", + "lrxnjeaseiphe", "\"datacbonqvpk\"")); model = BinaryData.fromObject(model).toObject(K8SSchedulingOptions.class); - Assertions.assertEquals("fsfksymddyst", model.resources().requests().get("i")); - Assertions.assertEquals("hqyudxorrqnbpoc", model.resources().limits().get("vyifqrvkdvjsl")); + Assertions.assertEquals("kftutqxlngxlefg", model.resources().requests().get("gnxkrxdqmidtth")); + Assertions.assertEquals("zgpphrcgyncocpe", model.resources().limits().get("fvm")); } // Use "Map.of" if available diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java index 297b93fde58c..59615cea002d 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSchedulingTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -16,25 +16,27 @@ public final class K8SSchedulingTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { K8SScheduling model = BinaryData.fromString( - "{\"default\":{\"resources\":{\"requests\":{\"xzdmohctb\":\"avo\"},\"limits\":{\"w\":\"dwxdndnv\",\"lazjdyggdtjixhbk\":\"ujjugwdkcglh\",\"fwhybcibvy\":\"ofqweykhmenevfye\",\"ynnaam\":\"dcsi\"},\"\":{\"zrkgqhcjrefovg\":\"datatehfiqscjeypvh\",\"jpkcattpng\":\"datakqsleyyvxy\",\"czsqpjhvm\":\"datacr\"}},\"\":{\"ysou\":\"datav\",\"canoaeupf\":\"dataq\",\"tuo\":\"datayhltrpmopjmcm\"}},\"\":{\"uaodsfcpk\":\"datafu\",\"xbezyiuokktwh\":\"dataxodpuozmyzydagfu\",\"o\":\"datadxwzywqsmbsurexi\"}}") + "{\"default\":{\"resources\":{\"requests\":{\"jionpimexgstxgc\":\"xobnbdxkqpxok\"},\"limits\":{\"djwzrlov\":\"gmaajrm\"},\"s\":\"\\\"datawhijcoejctbza\\\"\",\"ukdkexxppofmxa\":\"\\\"datasycbkbfk\\\"\",\"jpgd\":\"\\\"datac\\\"\",\"j\":\"\\\"datatoc\\\"\"},\"i\":\"\\\"datapmouexhdz\\\"\",\"deicbtwnpzao\":\"\\\"dataqeojnxqbzvddntw\\\"\",\"jthjqkwpyei\":\"\\\"datavuhrhcffcyddgl\\\"\",\"q\":\"\\\"dataxmqci\\\"\"},\"igdtopbob\":\"\\\"datahix\\\"\",\"m\":\"\\\"dataog\\\"\",\"a\":\"\\\"dataw\\\"\",\"hrzayvvtpgvdf\":\"\\\"dataa\\\"\"}") .toObject(K8SScheduling.class); - Assertions.assertEquals("avo", model.defaultProperty().resources().requests().get("xzdmohctb")); - Assertions.assertEquals("dwxdndnv", model.defaultProperty().resources().limits().get("w")); + Assertions.assertEquals("xobnbdxkqpxok", model.defaultProperty().resources().requests().get("jionpimexgstxgc")); + Assertions.assertEquals("gmaajrm", model.defaultProperty().resources().limits().get("djwzrlov")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { K8SScheduling model = new K8SScheduling() .withDefaultProperty(new K8SSchedulingOptions() - .withResources(new K8SResourceRequirements().withRequests(mapOf("xzdmohctb", "avo")) - .withLimits(mapOf("w", "dwxdndnv", "lazjdyggdtjixhbk", "ujjugwdkcglh", "fwhybcibvy", - "ofqweykhmenevfye", "ynnaam", "dcsi")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf()); + .withResources(new K8SResourceRequirements().withRequests(mapOf("jionpimexgstxgc", "xobnbdxkqpxok")) + .withLimits(mapOf("djwzrlov", "gmaajrm")) + .withAdditionalProperties(mapOf("jpgd", "\"datac\"", "s", "\"datawhijcoejctbza\"", "j", + "\"datatoc\"", "ukdkexxppofmxa", "\"datasycbkbfk\""))) + .withAdditionalProperties(mapOf("q", "\"dataxmqci\"", "deicbtwnpzao", "\"dataqeojnxqbzvddntw\"", + "jthjqkwpyei", "\"datavuhrhcffcyddgl\"", "i", "\"datapmouexhdz\""))) + .withAdditionalProperties( + mapOf("a", "\"dataw\"", "hrzayvvtpgvdf", "\"dataa\"", "igdtopbob", "\"datahix\"", "m", "\"dataog\"")); model = BinaryData.fromObject(model).toObject(K8SScheduling.class); - Assertions.assertEquals("avo", model.defaultProperty().resources().requests().get("xzdmohctb")); - Assertions.assertEquals("dwxdndnv", model.defaultProperty().resources().limits().get("w")); + Assertions.assertEquals("xobnbdxkqpxok", model.defaultProperty().resources().requests().get("jionpimexgstxgc")); + Assertions.assertEquals("gmaajrm", model.defaultProperty().resources().limits().get("djwzrlov")); } // Use "Map.of" if available diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSettingsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSettingsTests.java new file mode 100644 index 000000000000..6295d757aa92 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/K8SSettingsTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.K8SNetworkSettings; +import com.azure.resourcemanager.azurearcdata.models.K8SSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class K8SSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + K8SSettings model = BinaryData.fromString( + "{\"network\":{\"forceencryption\":1709538743,\"tlsciphers\":\"eupfhyhltrpm\",\"tlsprotocols\":\"jmcmatuokthfu\"},\"zydagfuaxbezyiuo\":\"\\\"dataodsfcpkvxodpuozm\\\"\",\"dxwzywqsmbsurexi\":\"\\\"dataktwh\\\"\",\"yocf\":\"\\\"datao\\\"\"}") + .toObject(K8SSettings.class); + Assertions.assertEquals(1709538743, model.network().forceencryption()); + Assertions.assertEquals("eupfhyhltrpm", model.network().tlsciphers()); + Assertions.assertEquals("jmcmatuokthfu", model.network().tlsprotocols()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + K8SSettings model = new K8SSettings() + .withNetwork(new K8SNetworkSettings().withForceencryption(1709538743) + .withTlsciphers("eupfhyhltrpm") + .withTlsprotocols("jmcmatuokthfu")) + .withAdditionalProperties(mapOf("zydagfuaxbezyiuo", "\"dataodsfcpkvxodpuozm\"", "dxwzywqsmbsurexi", + "\"dataktwh\"", "yocf", "\"datao\"")); + model = BinaryData.fromObject(model).toObject(K8SSettings.class); + Assertions.assertEquals(1709538743, model.network().forceencryption()); + Assertions.assertEquals("eupfhyhltrpm", model.network().tlsciphers()); + Assertions.assertEquals("jmcmatuokthfu", model.network().tlsprotocols()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ManagedInstanceLinkCreateUpdateConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ManagedInstanceLinkCreateUpdateConfigurationTests.java new file mode 100644 index 000000000000..3619abcdda4f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ManagedInstanceLinkCreateUpdateConfigurationTests.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.MiLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ManagedInstanceLinkCreateUpdateConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedInstanceLinkCreateUpdateConfiguration model = BinaryData.fromString( + "{\"availabilityGroup\":{\"availabilityGroupName\":\"vlagun\",\"replicas\":[{\"serverInstance\":\"ebwlnbmhyreeudzq\",\"endpointName\":\"bpdqmjxlyy\",\"endpointUrl\":\"lgouwtlmjj\",\"endpointAuthenticationMode\":\"Windows_NTLM_Certificate\",\"certificateName\":\"qtobaxkjeyt\",\"endpointConnectLogin\":\"lbfjkwr\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"failoverMode\":\"MANUAL\",\"seedingMode\":\"AUTOMATIC\",\"backupPriority\":90955577,\"secondaryRoleAllowConnections\":\"ALL\",\"secondaryRoleReadOnlyRoutingUrl\":\"njqhdenxa\",\"primaryRoleAllowConnections\":\"ALL\",\"primaryRoleReadOnlyRoutingList\":[\"kdk\",\"fmjnnawtqa\",\"pxuckpggq\",\"wey\"],\"sessionTimeout\":1687132419},{\"serverInstance\":\"lisn\",\"endpointName\":\"fl\",\"endpointUrl\":\"mpizru\",\"endpointAuthenticationMode\":\"Certificate_Windows_Negotiate\",\"certificateName\":\"xpxiwfcngjs\",\"endpointConnectLogin\":\"sii\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"failoverMode\":\"NONE\",\"seedingMode\":\"MANUAL\",\"backupPriority\":671429821,\"secondaryRoleAllowConnections\":\"READ_ONLY\",\"secondaryRoleReadOnlyRoutingUrl\":\"hgfgrwsd\",\"primaryRoleAllowConnections\":\"ALL\",\"primaryRoleReadOnlyRoutingList\":[\"zvzbglbyv\"],\"sessionTimeout\":2111130404}],\"databases\":[\"brxkjzwr\",\"xff\"],\"automatedBackupPreference\":\"NONE\",\"failureConditionLevel\":2,\"healthCheckTimeout\":1645764106,\"dbFailover\":\"ON\",\"dtcSupport\":\"NONE\",\"requiredSynchronizedSecondariesToCommit\":277381231,\"clusterType\":\"NONE\",\"listener\":{\"dnsName\":\"yd\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"aclnapxbiygnugj\",\"mask\":\"fsmfcttuxuuyi\"},{\"ipAddress\":\"lq\",\"mask\":\"quvre\"}],\"ipV6Addresses\":[\"njhvsujztc\",\"ytqj\",\"w\",\"auunfprnjletlx\"],\"port\":561102100}},\"distributedAvailabilityGroup\":{\"availabilityGroupName\":\"do\",\"primaryAvailabilityGroup\":{\"availabilityGroup\":\"amowaziynknlqwzd\",\"listenerUrl\":\"iwhxqszdtmaajq\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"failoverMode\":\"AUTOMATIC\",\"seedingMode\":\"MANUAL\",\"certificateConfiguration\":{\"certificateName\":\"m\"}},\"secondaryAvailabilityGroup\":{\"availabilityGroup\":\"jbmzyospspsh\",\"listenerUrl\":\"fkyjpmspbpssdfpp\",\"availabilityMode\":\"SYNCHRONOUS_COMMIT\",\"failoverMode\":\"MANUAL\",\"seedingMode\":\"MANUAL\",\"certificateConfiguration\":{\"certificateName\":\"tvczkcnyxr\"}}},\"miLinkConfiguration\":{\"instanceAvailabilityGroupName\":\"njdxvglnkvxl\"}}") + .toObject(ManagedInstanceLinkCreateUpdateConfiguration.class); + Assertions.assertEquals("vlagun", model.availabilityGroup().availabilityGroupName()); + Assertions.assertEquals("ebwlnbmhyreeudzq", model.availabilityGroup().replicas().get(0).serverInstance()); + Assertions.assertEquals("bpdqmjxlyy", model.availabilityGroup().replicas().get(0).endpointName()); + Assertions.assertEquals("lgouwtlmjj", model.availabilityGroup().replicas().get(0).endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM_CERTIFICATE, + model.availabilityGroup().replicas().get(0).endpointAuthenticationMode()); + Assertions.assertEquals("qtobaxkjeyt", model.availabilityGroup().replicas().get(0).certificateName()); + Assertions.assertEquals("lbfjkwr", model.availabilityGroup().replicas().get(0).endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.availabilityGroup().replicas().get(0).availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.availabilityGroup().replicas().get(0).failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.availabilityGroup().replicas().get(0).seedingMode()); + Assertions.assertEquals(90955577, model.availabilityGroup().replicas().get(0).backupPriority()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, + model.availabilityGroup().replicas().get(0).secondaryRoleAllowConnections()); + Assertions.assertEquals("njqhdenxa", + model.availabilityGroup().replicas().get(0).secondaryRoleReadOnlyRoutingUrl()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, + model.availabilityGroup().replicas().get(0).primaryRoleAllowConnections()); + Assertions.assertEquals("kdk", + model.availabilityGroup().replicas().get(0).primaryRoleReadOnlyRoutingList().get(0)); + Assertions.assertEquals(1687132419, model.availabilityGroup().replicas().get(0).sessionTimeout()); + Assertions.assertEquals("brxkjzwr", model.availabilityGroup().databases().get(0)); + Assertions.assertEquals(AutomatedBackupPreference.NONE, model.availabilityGroup().automatedBackupPreference()); + Assertions.assertEquals(FailureConditionLevel.TWO, model.availabilityGroup().failureConditionLevel()); + Assertions.assertEquals(1645764106, model.availabilityGroup().healthCheckTimeout()); + Assertions.assertEquals(DbFailover.ON, model.availabilityGroup().dbFailover()); + Assertions.assertEquals(DtcSupport.NONE, model.availabilityGroup().dtcSupport()); + Assertions.assertEquals(277381231, model.availabilityGroup().requiredSynchronizedSecondariesToCommit()); + Assertions.assertEquals(ClusterType.NONE, model.availabilityGroup().clusterType()); + Assertions.assertEquals("yd", model.availabilityGroup().listener().dnsName()); + Assertions.assertEquals("aclnapxbiygnugj", + model.availabilityGroup().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("fsmfcttuxuuyi", + model.availabilityGroup().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("njhvsujztc", model.availabilityGroup().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(561102100, model.availabilityGroup().listener().port()); + Assertions.assertEquals("do", model.distributedAvailabilityGroup().availabilityGroupName()); + Assertions.assertEquals("amowaziynknlqwzd", + model.distributedAvailabilityGroup().primaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("iwhxqszdtmaajq", + model.distributedAvailabilityGroup().primaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.distributedAvailabilityGroup().primaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, + model.distributedAvailabilityGroup().primaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, + model.distributedAvailabilityGroup().primaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("m", + model.distributedAvailabilityGroup() + .primaryAvailabilityGroup() + .certificateConfiguration() + .certificateName()); + Assertions.assertEquals("jbmzyospspsh", + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("fkyjpmspbpssdfpp", + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("tvczkcnyxr", + model.distributedAvailabilityGroup() + .secondaryAvailabilityGroup() + .certificateConfiguration() + .certificateName()); + Assertions.assertEquals("njdxvglnkvxl", model.miLinkConfiguration().instanceAvailabilityGroupName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedInstanceLinkCreateUpdateConfiguration model + = new ManagedInstanceLinkCreateUpdateConfiguration() + .withAvailabilityGroup( + new AvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("vlagun") + .withReplicas(Arrays.asList( + new AvailabilityGroupCreateUpdateReplicaConfiguration() + .withServerInstance("ebwlnbmhyreeudzq") + .withEndpointName("bpdqmjxlyy") + .withEndpointUrl("lgouwtlmjj") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NTLM_CERTIFICATE) + .withCertificateName("qtobaxkjeyt") + .withEndpointConnectLogin("lbfjkwr") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(90955577) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.ALL) + .withSecondaryRoleReadOnlyRoutingUrl("njqhdenxa") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList( + Arrays.asList("kdk", "fmjnnawtqa", "pxuckpggq", "wey")) + .withSessionTimeout(1687132419), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("lisn") + .withEndpointName("fl") + .withEndpointUrl("mpizru") + .withEndpointAuthenticationMode(ConnectionAuth.CERTIFICATE_WINDOWS_NEGOTIATE) + .withCertificateName("xpxiwfcngjs") + .withEndpointConnectLogin("sii") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.MANUAL) + .withBackupPriority(671429821) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withSecondaryRoleReadOnlyRoutingUrl("hgfgrwsd") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList(Arrays.asList("zvzbglbyv")) + .withSessionTimeout(2111130404))) + .withDatabases(Arrays.asList("brxkjzwr", "xff")) + .withAutomatedBackupPreference(AutomatedBackupPreference.NONE) + .withFailureConditionLevel(FailureConditionLevel.TWO) + .withHealthCheckTimeout(1645764106) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.NONE) + .withRequiredSynchronizedSecondariesToCommit(277381231) + .withClusterType(ClusterType.NONE) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("yd") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() + .withIpAddress("aclnapxbiygnugj") + .withMask("fsmfcttuxuuyi"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("lq") + .withMask("quvre"))) + .withIpV6Addresses(Arrays.asList("njhvsujztc", "ytqj", "w", "auunfprnjletlx")) + .withPort(561102100))) + .withDistributedAvailabilityGroup(new DistributedAvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("do") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("amowaziynknlqwzd") + .withListenerUrl("iwhxqszdtmaajq") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.MANUAL) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("m"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("jbmzyospspsh") + .withListenerUrl("fkyjpmspbpssdfpp") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.MANUAL) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("tvczkcnyxr")))) + .withMiLinkConfiguration( + new MiLinkCreateUpdateConfiguration().withInstanceAvailabilityGroupName("njdxvglnkvxl")); + model = BinaryData.fromObject(model).toObject(ManagedInstanceLinkCreateUpdateConfiguration.class); + Assertions.assertEquals("vlagun", model.availabilityGroup().availabilityGroupName()); + Assertions.assertEquals("ebwlnbmhyreeudzq", model.availabilityGroup().replicas().get(0).serverInstance()); + Assertions.assertEquals("bpdqmjxlyy", model.availabilityGroup().replicas().get(0).endpointName()); + Assertions.assertEquals("lgouwtlmjj", model.availabilityGroup().replicas().get(0).endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM_CERTIFICATE, + model.availabilityGroup().replicas().get(0).endpointAuthenticationMode()); + Assertions.assertEquals("qtobaxkjeyt", model.availabilityGroup().replicas().get(0).certificateName()); + Assertions.assertEquals("lbfjkwr", model.availabilityGroup().replicas().get(0).endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.availabilityGroup().replicas().get(0).availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.availabilityGroup().replicas().get(0).failoverMode()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.availabilityGroup().replicas().get(0).seedingMode()); + Assertions.assertEquals(90955577, model.availabilityGroup().replicas().get(0).backupPriority()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, + model.availabilityGroup().replicas().get(0).secondaryRoleAllowConnections()); + Assertions.assertEquals("njqhdenxa", + model.availabilityGroup().replicas().get(0).secondaryRoleReadOnlyRoutingUrl()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, + model.availabilityGroup().replicas().get(0).primaryRoleAllowConnections()); + Assertions.assertEquals("kdk", + model.availabilityGroup().replicas().get(0).primaryRoleReadOnlyRoutingList().get(0)); + Assertions.assertEquals(1687132419, model.availabilityGroup().replicas().get(0).sessionTimeout()); + Assertions.assertEquals("brxkjzwr", model.availabilityGroup().databases().get(0)); + Assertions.assertEquals(AutomatedBackupPreference.NONE, model.availabilityGroup().automatedBackupPreference()); + Assertions.assertEquals(FailureConditionLevel.TWO, model.availabilityGroup().failureConditionLevel()); + Assertions.assertEquals(1645764106, model.availabilityGroup().healthCheckTimeout()); + Assertions.assertEquals(DbFailover.ON, model.availabilityGroup().dbFailover()); + Assertions.assertEquals(DtcSupport.NONE, model.availabilityGroup().dtcSupport()); + Assertions.assertEquals(277381231, model.availabilityGroup().requiredSynchronizedSecondariesToCommit()); + Assertions.assertEquals(ClusterType.NONE, model.availabilityGroup().clusterType()); + Assertions.assertEquals("yd", model.availabilityGroup().listener().dnsName()); + Assertions.assertEquals("aclnapxbiygnugj", + model.availabilityGroup().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("fsmfcttuxuuyi", + model.availabilityGroup().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("njhvsujztc", model.availabilityGroup().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(561102100, model.availabilityGroup().listener().port()); + Assertions.assertEquals("do", model.distributedAvailabilityGroup().availabilityGroupName()); + Assertions.assertEquals("amowaziynknlqwzd", + model.distributedAvailabilityGroup().primaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("iwhxqszdtmaajq", + model.distributedAvailabilityGroup().primaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.distributedAvailabilityGroup().primaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, + model.distributedAvailabilityGroup().primaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, + model.distributedAvailabilityGroup().primaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("m", + model.distributedAvailabilityGroup() + .primaryAvailabilityGroup() + .certificateConfiguration() + .certificateName()); + Assertions.assertEquals("jbmzyospspsh", + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().availabilityGroup()); + Assertions.assertEquals("fkyjpmspbpssdfpp", + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().listenerUrl()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().failoverMode()); + Assertions.assertEquals(SeedingMode.MANUAL, + model.distributedAvailabilityGroup().secondaryAvailabilityGroup().seedingMode()); + Assertions.assertEquals("tvczkcnyxr", + model.distributedAvailabilityGroup() + .secondaryAvailabilityGroup() + .certificateConfiguration() + .certificateName()); + Assertions.assertEquals("njdxvglnkvxl", model.miLinkConfiguration().instanceAvailabilityGroupName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MiLinkCreateUpdateConfigurationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MiLinkCreateUpdateConfigurationTests.java new file mode 100644 index 000000000000..b046ecdad78b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MiLinkCreateUpdateConfigurationTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.MiLinkCreateUpdateConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class MiLinkCreateUpdateConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MiLinkCreateUpdateConfiguration model + = BinaryData.fromString("{\"instanceAvailabilityGroupName\":\"aglqivbgkcvkh\"}") + .toObject(MiLinkCreateUpdateConfiguration.class); + Assertions.assertEquals("aglqivbgkcvkh", model.instanceAvailabilityGroupName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MiLinkCreateUpdateConfiguration model + = new MiLinkCreateUpdateConfiguration().withInstanceAvailabilityGroupName("aglqivbgkcvkh"); + model = BinaryData.fromObject(model).toObject(MiLinkCreateUpdateConfiguration.class); + Assertions.assertEquals("aglqivbgkcvkh", model.instanceAvailabilityGroupName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MigrationAssessmentSettingsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MigrationAssessmentSettingsTests.java new file mode 100644 index 000000000000..037530049ba1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MigrationAssessmentSettingsTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.CostOptionSelectedValues; +import com.azure.resourcemanager.azurearcdata.models.MigrationAssessmentSettings; +import org.junit.jupiter.api.Assertions; + +public final class MigrationAssessmentSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrationAssessmentSettings model = BinaryData.fromString( + "{\"targetLocation\":\"gqzcjr\",\"percentile\":47.687644197856926,\"lookbackPeriodInDays\":1207917179,\"comfortFactor\":1413734297,\"strategy\":\"xkvugfhzov\",\"currency\":\"jvzunluthnnp\",\"discountPercentage\":83.2284629734643,\"costOptions\":{\"computeAndStorageCostOption\":\"ilpjzuaejxdult\",\"sqlLicenseCostOption\":\"zbbtdzumveek\",\"windowsLicenseCostOption\":\"wozuhkf\"}}") + .toObject(MigrationAssessmentSettings.class); + Assertions.assertEquals("gqzcjr", model.targetLocation()); + Assertions.assertEquals(47.687644197856926D, model.percentile()); + Assertions.assertEquals(1207917179, model.lookbackPeriodInDays()); + Assertions.assertEquals(1413734297, model.comfortFactor()); + Assertions.assertEquals("xkvugfhzov", model.strategy()); + Assertions.assertEquals("jvzunluthnnp", model.currency()); + Assertions.assertEquals(83.2284629734643D, model.discountPercentage()); + Assertions.assertEquals("ilpjzuaejxdult", model.costOptions().computeAndStorageCostOption()); + Assertions.assertEquals("zbbtdzumveek", model.costOptions().sqlLicenseCostOption()); + Assertions.assertEquals("wozuhkf", model.costOptions().windowsLicenseCostOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrationAssessmentSettings model = new MigrationAssessmentSettings().withTargetLocation("gqzcjr") + .withPercentile(47.687644197856926D) + .withLookbackPeriodInDays(1207917179) + .withComfortFactor(1413734297) + .withStrategy("xkvugfhzov") + .withCurrency("jvzunluthnnp") + .withDiscountPercentage(83.2284629734643D) + .withCostOptions(new CostOptionSelectedValues().withComputeAndStorageCostOption("ilpjzuaejxdult") + .withSqlLicenseCostOption("zbbtdzumveek") + .withWindowsLicenseCostOption("wozuhkf")); + model = BinaryData.fromObject(model).toObject(MigrationAssessmentSettings.class); + Assertions.assertEquals("gqzcjr", model.targetLocation()); + Assertions.assertEquals(47.687644197856926D, model.percentile()); + Assertions.assertEquals(1207917179, model.lookbackPeriodInDays()); + Assertions.assertEquals(1413734297, model.comfortFactor()); + Assertions.assertEquals("xkvugfhzov", model.strategy()); + Assertions.assertEquals("jvzunluthnnp", model.currency()); + Assertions.assertEquals(83.2284629734643D, model.discountPercentage()); + Assertions.assertEquals("ilpjzuaejxdult", model.costOptions().computeAndStorageCostOption()); + Assertions.assertEquals("zbbtdzumveek", model.costOptions().sqlLicenseCostOption()); + Assertions.assertEquals("wozuhkf", model.costOptions().windowsLicenseCostOption()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MonitoringTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MonitoringTests.java new file mode 100644 index 000000000000..0e623c43230e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/MonitoringTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.Monitoring; +import org.junit.jupiter.api.Assertions; + +public final class MonitoringTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Monitoring model = BinaryData.fromString("{\"enabled\":false}").toObject(Monitoring.class); + Assertions.assertFalse(model.enabled()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Monitoring model = new Monitoring().withEnabled(false); + model = BinaryData.fromObject(model).toObject(Monitoring.class); + Assertions.assertFalse(model.enabled()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java index 91d99bbea287..c4693029bbfd 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationDisplayTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -19,17 +19,4 @@ public void testDeserialize() throws Exception { Assertions.assertEquals("ryo", model.operation()); Assertions.assertEquals("psoacctazakljl", model.description()); } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay().withProvider("iodjp") - .withResource("lwejdpv") - .withOperation("ryo") - .withDescription("psoacctazakljl"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("iodjp", model.provider()); - Assertions.assertEquals("lwejdpv", model.resource()); - Assertions.assertEquals("ryo", model.operation()); - Assertions.assertEquals("psoacctazakljl", model.description()); - } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java index 7d7b708286d7..324f06bbef38 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationInnerTests.java @@ -1,42 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.azurearcdata.fluent.models.OperationInner; -import com.azure.resourcemanager.azurearcdata.models.OperationDisplay; import org.junit.jupiter.api.Assertions; public final class OperationInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { OperationInner model = BinaryData.fromString( - "{\"name\":\"lokjyemkk\",\"display\":{\"provider\":\"ni\",\"resource\":\"joxzjnchgejspodm\",\"operation\":\"ilzyd\",\"description\":\"h\"},\"origin\":\"system\",\"isDataAction\":false,\"properties\":{\"ixjsprozvcputeg\":\"datauxinpmqnjaq\",\"atscmd\":\"datavwmf\",\"zkrwfn\":\"datapjhulsuuvmkj\"}}") + "{\"name\":\"lokjyemkk\",\"display\":{\"provider\":\"ni\",\"resource\":\"joxzjnchgejspodm\",\"operation\":\"ilzyd\",\"description\":\"h\"},\"origin\":\"system\",\"isDataAction\":false,\"properties\":{\"ixjsprozvcputeg\":\"\\\"datauxinpmqnjaq\\\"\",\"atscmd\":\"\\\"datavwmf\\\"\",\"zkrwfn\":\"\\\"datapjhulsuuvmkj\\\"\"}}") .toObject(OperationInner.class); Assertions.assertEquals("lokjyemkk", model.name()); Assertions.assertEquals("ni", model.display().provider()); Assertions.assertEquals("joxzjnchgejspodm", model.display().resource()); Assertions.assertEquals("ilzyd", model.display().operation()); Assertions.assertEquals("h", model.display().description()); - Assertions.assertEquals(false, model.isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withName("lokjyemkk") - .withDisplay(new OperationDisplay().withProvider("ni") - .withResource("joxzjnchgejspodm") - .withOperation("ilzyd") - .withDescription("h")) - .withIsDataAction(false); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals("lokjyemkk", model.name()); - Assertions.assertEquals("ni", model.display().provider()); - Assertions.assertEquals("joxzjnchgejspodm", model.display().resource()); - Assertions.assertEquals("ilzyd", model.display().operation()); - Assertions.assertEquals("h", model.display().description()); - Assertions.assertEquals(false, model.isDataAction()); + Assertions.assertFalse(model.isDataAction()); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java index 2eb037907264..034ce10e18ca 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationListResultTests.java @@ -1,23 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.OperationListResult; +import com.azure.resourcemanager.azurearcdata.implementation.models.OperationListResult; public final class OperationListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { OperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"hq\",\"display\":{\"provider\":\"vgjxpybczm\",\"resource\":\"hmtzopbsphrup\",\"operation\":\"dgs\",\"description\":\"bb\"},\"origin\":\"user\",\"isDataAction\":false,\"properties\":{\"xaobhdxbmtqioqjz\":\"dataycm\",\"ownoizhw\":\"datahtbmuf\",\"jgkdmbpazlobcu\":\"datarxybqsoq\",\"qgn\":\"datapdznrbtcqqjnqgl\"}},{\"name\":\"foooj\",\"display\":{\"provider\":\"wifsq\",\"resource\":\"saagdf\",\"operation\":\"glzlhjxrifkwmrv\",\"description\":\"tsizntocipaoua\"},\"origin\":\"user\",\"isDataAction\":false,\"properties\":{\"fogknygjofjdde\":\"datampoyfd\",\"deupewnwrei\":\"datas\",\"arhmofcqhsmy\":\"datajzyflu\",\"kuksjtxukcdm\":\"datarkdtmlxh\"}},{\"name\":\"arcryuanzwuxzdxt\",\"display\":{\"provider\":\"yrlhmwhfpmrqobm\",\"resource\":\"u\",\"operation\":\"knryrtihfxtij\",\"description\":\"pzvgnwzsymglzufc\"},\"origin\":\"user\",\"isDataAction\":true,\"properties\":{\"fcbjysagithxqha\":\"databihanuf\",\"cnpqxuhivyqniwby\":\"dataifpikxwczby\",\"grtfwvu\":\"datarkxvdum\",\"h\":\"dataxgaudccs\"}}],\"nextLink\":\"cnyejhkryhtnapcz\"}") + "{\"value\":[{\"name\":\"hq\",\"display\":{\"provider\":\"vgjxpybczm\",\"resource\":\"hmtzopbsphrup\",\"operation\":\"dgs\",\"description\":\"bb\"},\"origin\":\"user\",\"isDataAction\":false,\"properties\":{\"xaobhdxbmtqioqjz\":\"\\\"dataycm\\\"\",\"ownoizhw\":\"\\\"datahtbmuf\\\"\",\"jgkdmbpazlobcu\":\"\\\"datarxybqsoq\\\"\",\"qgn\":\"\\\"datapdznrbtcqqjnqgl\\\"\"}},{\"name\":\"foooj\",\"display\":{\"provider\":\"wifsq\",\"resource\":\"saagdf\",\"operation\":\"glzlhjxrifkwmrv\",\"description\":\"tsizntocipaoua\"},\"origin\":\"user\",\"isDataAction\":false,\"properties\":{\"fogknygjofjdde\":\"\\\"datampoyfd\\\"\",\"deupewnwrei\":\"\\\"datas\\\"\",\"arhmofcqhsmy\":\"\\\"datajzyflu\\\"\",\"kuksjtxukcdm\":\"\\\"datarkdtmlxh\\\"\"}},{\"name\":\"arcryuanzwuxzdxt\",\"display\":{\"provider\":\"yrlhmwhfpmrqobm\",\"resource\":\"u\",\"operation\":\"knryrtihfxtij\",\"description\":\"pzvgnwzsymglzufc\"},\"origin\":\"user\",\"isDataAction\":true,\"properties\":{\"fcbjysagithxqha\":\"\\\"databihanuf\\\"\",\"cnpqxuhivyqniwby\":\"\\\"dataifpikxwczby\\\"\",\"grtfwvu\":\"\\\"datarkxvdum\\\"\",\"h\":\"\\\"dataxgaudccs\\\"\"}}],\"nextLink\":\"cnyejhkryhtnapcz\"}") .toObject(OperationListResult.class); } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java index ba9d28131a66..0f01014792ec 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/OperationsListMockTests.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; import com.azure.resourcemanager.azurearcdata.models.Operation; @@ -22,22 +22,22 @@ public final class OperationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"name\":\"wxqpsrknftguvri\",\"display\":{\"provider\":\"hprwmdyv\",\"resource\":\"qtayri\",\"operation\":\"wroyqbexrmcq\",\"description\":\"bycnojvkn\"},\"origin\":\"system\",\"isDataAction\":true,\"properties\":{\"hpvgqz\":\"datazvahapjy\"}}]}"; + = "{\"value\":[{\"name\":\"iylylyfw\",\"display\":{\"provider\":\"zutgqztwhghmupg\",\"resource\":\"yjtcdxabbujftab\",\"operation\":\"nbbklqpxzucafed\",\"description\":\"wwnlzafwxudgnh\"},\"origin\":\"system\",\"isDataAction\":false,\"properties\":{\"meluclvdjj\":\"\\\"dataalvnbwgpb\\\"\",\"hhxhq\":\"\\\"datakyrdnqodx\\\"\",\"v\":\"\\\"dataaqnvzoqgyipemchg\\\"\"}}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureArcDataManager manager = AzureArcDataManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("wxqpsrknftguvri", response.iterator().next().name()); - Assertions.assertEquals("hprwmdyv", response.iterator().next().display().provider()); - Assertions.assertEquals("qtayri", response.iterator().next().display().resource()); - Assertions.assertEquals("wroyqbexrmcq", response.iterator().next().display().operation()); - Assertions.assertEquals("bycnojvkn", response.iterator().next().display().description()); - Assertions.assertEquals(true, response.iterator().next().isDataAction()); + Assertions.assertEquals("iylylyfw", response.iterator().next().name()); + Assertions.assertEquals("zutgqztwhghmupg", response.iterator().next().display().provider()); + Assertions.assertEquals("yjtcdxabbujftab", response.iterator().next().display().resource()); + Assertions.assertEquals("nbbklqpxzucafed", response.iterator().next().display().operation()); + Assertions.assertEquals("wwnlzafwxudgnh", response.iterator().next().display().description()); + Assertions.assertFalse(response.iterator().next().isDataAction()); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstanceSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstanceSkuTests.java new file mode 100644 index 000000000000..78c1c5e6b192 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstanceSkuTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSku; +import com.azure.resourcemanager.azurearcdata.models.PostgresInstanceSkuTier; +import org.junit.jupiter.api.Assertions; + +public final class PostgresInstanceSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PostgresInstanceSku model = BinaryData.fromString( + "{\"tier\":\"Hyperscale\",\"name\":\"dcwboxjum\",\"dev\":false,\"size\":\"lihrraiouaubr\",\"family\":\"loqxfuojrngif\",\"capacity\":193344927}") + .toObject(PostgresInstanceSku.class); + Assertions.assertEquals("dcwboxjum", model.name()); + Assertions.assertFalse(model.dev()); + Assertions.assertEquals("lihrraiouaubr", model.size()); + Assertions.assertEquals("loqxfuojrngif", model.family()); + Assertions.assertEquals(193344927, model.capacity()); + Assertions.assertEquals(PostgresInstanceSkuTier.HYPERSCALE, model.tier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PostgresInstanceSku model = new PostgresInstanceSku().withName("dcwboxjum") + .withDev(false) + .withSize("lihrraiouaubr") + .withFamily("loqxfuojrngif") + .withCapacity(193344927) + .withTier(PostgresInstanceSkuTier.HYPERSCALE); + model = BinaryData.fromObject(model).toObject(PostgresInstanceSku.class); + Assertions.assertEquals("dcwboxjum", model.name()); + Assertions.assertFalse(model.dev()); + Assertions.assertEquals("lihrraiouaubr", model.size()); + Assertions.assertEquals("loqxfuojrngif", model.family()); + Assertions.assertEquals(193344927, model.capacity()); + Assertions.assertEquals(PostgresInstanceSkuTier.HYPERSCALE, model.tier()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteMockTests.java new file mode 100644 index 000000000000..e1426b973857 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/PostgresInstancesDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PostgresInstancesDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.postgresInstances().delete("jwpindedvabbxbh", "edeilb", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ScheduleTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ScheduleTests.java new file mode 100644 index 000000000000..7e3a189e334c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ScheduleTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.CronTrigger; +import com.azure.resourcemanager.azurearcdata.models.Schedule; +import org.junit.jupiter.api.Assertions; + +public final class ScheduleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Schedule model = BinaryData.fromString( + "{\"enabled\":true,\"cronTrigger\":{\"startTime\":\"queziky\",\"timeZone\":\"gxk\",\"expression\":\"la\"}}") + .toObject(Schedule.class); + Assertions.assertTrue(model.enabled()); + Assertions.assertEquals("queziky", model.cronTrigger().startTime()); + Assertions.assertEquals("gxk", model.cronTrigger().timeZone()); + Assertions.assertEquals("la", model.cronTrigger().expression()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Schedule model = new Schedule().withEnabled(true) + .withCronTrigger(new CronTrigger().withStartTime("queziky").withTimeZone("gxk").withExpression("la")); + model = BinaryData.fromObject(model).toObject(Schedule.class); + Assertions.assertTrue(model.enabled()); + Assertions.assertEquals("queziky", model.cronTrigger().startTime()); + Assertions.assertEquals("gxk", model.cronTrigger().timeZone()); + Assertions.assertEquals("la", model.cronTrigger().expression()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SequencerActionTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SequencerActionTests.java new file mode 100644 index 000000000000..044a63b92527 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SequencerActionTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerAction; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import org.junit.jupiter.api.Assertions; + +public final class SequencerActionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SequencerAction model + = BinaryData.fromString("{\"actionId\":\"zg\",\"state\":\"NotStarted\",\"result\":\"TimedOut\"}") + .toObject(SequencerAction.class); + Assertions.assertEquals("zg", model.actionId()); + Assertions.assertEquals(SequencerState.NOT_STARTED, model.state()); + Assertions.assertEquals(Result.TIMED_OUT, model.result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ServerAssessmentsItemTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ServerAssessmentsItemTests.java new file mode 100644 index 000000000000..9b88f4f07613 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ServerAssessmentsItemTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ServerAssessmentsItem; +import org.junit.jupiter.api.Assertions; + +public final class ServerAssessmentsItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerAssessmentsItem model = BinaryData.fromString( + "{\"appliesToMigrationTargetPlatform\":\"lns\",\"featureId\":\"bxwyjsflhhcaa\",\"impactedObjects\":[{\"impactDetail\":\"xisxyawjoyaqcsl\",\"name\":\"pkii\",\"objectType\":\"yexz\"},{\"impactDetail\":\"lixhnrztfol\",\"name\":\"nxknalaulp\",\"objectType\":\"gdtpnapnyiro\"},{\"impactDetail\":\"hpigv\",\"name\":\"ylgqgitxmedjvcsl\",\"objectType\":\"qwwncw\"},{\"impactDetail\":\"hxg\",\"name\":\"rmgucnap\",\"objectType\":\"eoellwptfdygp\"}],\"issueCategory\":\"b\",\"moreInformation\":\"ceopzfqrhhuaopp\"}") + .toObject(ServerAssessmentsItem.class); + Assertions.assertEquals("lns", model.appliesToMigrationTargetPlatform()); + Assertions.assertEquals("bxwyjsflhhcaa", model.featureId()); + Assertions.assertEquals("xisxyawjoyaqcsl", model.impactedObjects().get(0).impactDetail()); + Assertions.assertEquals("pkii", model.impactedObjects().get(0).name()); + Assertions.assertEquals("yexz", model.impactedObjects().get(0).objectType()); + Assertions.assertEquals("b", model.issueCategory()); + Assertions.assertEquals("ceopzfqrhhuaopp", model.moreInformation()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ServerAssessmentsPropertiesItemsItemTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ServerAssessmentsPropertiesItemsItemTests.java new file mode 100644 index 000000000000..56812bd83ce6 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/ServerAssessmentsPropertiesItemsItemTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ServerAssessmentsPropertiesItemsItem; +import org.junit.jupiter.api.Assertions; + +public final class ServerAssessmentsPropertiesItemsItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerAssessmentsPropertiesItemsItem model = BinaryData + .fromString("{\"impactDetail\":\"qeqxo\",\"name\":\"dahzxctobg\",\"objectType\":\"dmoizpostmg\"}") + .toObject(ServerAssessmentsPropertiesItemsItem.class); + Assertions.assertEquals("qeqxo", model.impactDetail()); + Assertions.assertEquals("dahzxctobg", model.name()); + Assertions.assertEquals("dmoizpostmg", model.objectType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategoryTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategoryTests.java new file mode 100644 index 000000000000..d732fc11adf3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategoryTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategoryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory model = BinaryData.fromString( + "{\"computeTier\":\"cjhwq\",\"hardwareType\":\"jrybnwjewgdrjer\",\"sqlPurchasingModel\":\"aen\",\"sqlServiceTier\":\"eh\",\"zoneRedundancyAvailable\":false}") + .toObject(SkuRecommendationResultsAzureSqlDatabaseTargetSkuCategory.class); + Assertions.assertEquals("cjhwq", model.computeTier()); + Assertions.assertEquals("jrybnwjewgdrjer", model.hardwareType()); + Assertions.assertEquals("aen", model.sqlPurchasingModel()); + Assertions.assertEquals("eh", model.sqlServiceTier()); + Assertions.assertFalse(model.zoneRedundancyAvailable()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlDatabaseTargetSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlDatabaseTargetSkuTests.java new file mode 100644 index 000000000000..28a7b268ef05 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlDatabaseTargetSkuTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlDatabaseTargetSku; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlDatabaseTargetSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlDatabaseTargetSku model = BinaryData.fromString( + "{\"category\":{\"computeTier\":\"vasrruvwb\",\"hardwareType\":\"qfsubcgjbirx\",\"sqlPurchasingModel\":\"ybsrfbjfdtwss\",\"sqlServiceTier\":\"ftpvjzbexil\",\"zoneRedundancyAvailable\":false},\"computeSize\":2126872967,\"storageMaxSizeInMb\":76.39232311042052,\"predictedDataSizeInMb\":42.55340821001343,\"predictedLogSizeInMb\":63.97203194524457,\"maxStorageIops\":71.66611969321049,\"maxThroughputMBps\":64.51790458576274}") + .toObject(SkuRecommendationResultsAzureSqlDatabaseTargetSku.class); + Assertions.assertEquals("vasrruvwb", model.category().computeTier()); + Assertions.assertEquals("qfsubcgjbirx", model.category().hardwareType()); + Assertions.assertEquals("ybsrfbjfdtwss", model.category().sqlPurchasingModel()); + Assertions.assertEquals("ftpvjzbexil", model.category().sqlServiceTier()); + Assertions.assertFalse(model.category().zoneRedundancyAvailable()); + Assertions.assertEquals(2126872967, model.computeSize()); + Assertions.assertEquals(76.39232311042052D, model.storageMaxSizeInMb()); + Assertions.assertEquals(42.55340821001343D, model.predictedDataSizeInMb()); + Assertions.assertEquals(63.97203194524457D, model.predictedLogSizeInMb()); + Assertions.assertEquals(71.66611969321049D, model.maxStorageIops()); + Assertions.assertEquals(64.51790458576274D, model.maxThroughputMBps()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategoryTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategoryTests.java new file mode 100644 index 000000000000..9b3e035fe9ec --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategoryTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategoryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory model = BinaryData.fromString( + "{\"computeTier\":\"blylpstdbh\",\"hardwareType\":\"srzdzucerscdn\",\"sqlPurchasingModel\":\"evfiwjmygt\",\"sqlServiceTier\":\"slswtm\",\"zoneRedundancyAvailable\":true}") + .toObject(SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuCategory.class); + Assertions.assertEquals("blylpstdbh", model.computeTier()); + Assertions.assertEquals("srzdzucerscdn", model.hardwareType()); + Assertions.assertEquals("evfiwjmygt", model.sqlPurchasingModel()); + Assertions.assertEquals("slswtm", model.sqlServiceTier()); + Assertions.assertTrue(model.zoneRedundancyAvailable()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuTests.java new file mode 100644 index 000000000000..af15adb2229b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlManagedInstanceTargetSku; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlManagedInstanceTargetSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlManagedInstanceTargetSku model = BinaryData.fromString( + "{\"category\":{\"computeTier\":\"duiertgcc\",\"hardwareType\":\"vaolpsslqlf\",\"sqlPurchasingModel\":\"dnbbglzps\",\"sqlServiceTier\":\"ydmcwyhzdxssa\",\"zoneRedundancyAvailable\":true},\"computeSize\":122725512,\"storageMaxSizeInMb\":61.3564516932404,\"predictedDataSizeInMb\":2.5464103691215323,\"predictedLogSizeInMb\":10.515478352876817,\"maxStorageIops\":37.63946015522745,\"maxThroughputMBps\":93.7455229501981}") + .toObject(SkuRecommendationResultsAzureSqlManagedInstanceTargetSku.class); + Assertions.assertEquals("duiertgcc", model.category().computeTier()); + Assertions.assertEquals("vaolpsslqlf", model.category().hardwareType()); + Assertions.assertEquals("dnbbglzps", model.category().sqlPurchasingModel()); + Assertions.assertEquals("ydmcwyhzdxssa", model.category().sqlServiceTier()); + Assertions.assertTrue(model.category().zoneRedundancyAvailable()); + Assertions.assertEquals(122725512, model.computeSize()); + Assertions.assertEquals(61.3564516932404D, model.storageMaxSizeInMb()); + Assertions.assertEquals(2.5464103691215323D, model.predictedDataSizeInMb()); + Assertions.assertEquals(10.515478352876817D, model.predictedLogSizeInMb()); + Assertions.assertEquals(37.63946015522745D, model.maxStorageIops()); + Assertions.assertEquals(93.7455229501981D, model.maxThroughputMBps()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategoryTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategoryTests.java new file mode 100644 index 000000000000..2072528cb245 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategoryTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategoryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory model = BinaryData.fromString( + "{\"availableVmSkus\":[\"kulpiujwaasi\",\"qiiobyuqer\",\"qlpqwcciuq\"],\"virtualMachineFamily\":\"dbutauvfbtkuwhh\"}") + .toObject(SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuCategory.class); + Assertions.assertEquals("kulpiujwaasi", model.availableVmSkus().get(0)); + Assertions.assertEquals("dbutauvfbtkuwhh", model.virtualMachineFamily()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuTests.java new file mode 100644 index 000000000000..88fa730d0427 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSku; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSku model = BinaryData.fromString( + "{\"category\":{\"availableVmSkus\":[\"tppjflcx\",\"gaokonzmnsikv\",\"kqze\",\"qkdltfz\"],\"virtualMachineFamily\":\"hhvh\"},\"computeSize\":67653444,\"predictedDataSizeInMb\":40.710108793520426,\"predictedLogSizeInMb\":78.99571328023603,\"virtualMachineSize\":{\"virtualMachineFamily\":\"agxti\",\"sizeName\":\"dxbx\",\"computeSize\":1137353961,\"azureSkuName\":\"ogqxndlkzgxhuri\",\"vCPUsAvailable\":1090180987,\"maxNetworkInterfaces\":1185146175},\"dataDiskSizes\":[{\"diskType\":\"nkbebxmuby\",\"redundancy\":\"twlrbqt\",\"size\":\"ievseotgqrllt\",\"caching\":\"wlauwzizxbmpg\",\"maxSizeInGib\":71.0532838258196,\"maxThroughputInMbps\":95.067817287676,\"maxIops\":36.579743591782034},{\"diskType\":\"ttdumorppxebmnzb\",\"redundancy\":\"hjpglkf\",\"size\":\"hdneuelfph\",\"caching\":\"yhtozfikdowwqu\",\"maxSizeInGib\":25.578916241896977,\"maxThroughputInMbps\":30.7197955800796,\"maxIops\":49.28608057771579},{\"diskType\":\"hqzonosggbhcoh\",\"redundancy\":\"dsjnka\",\"size\":\"utiiswacf\",\"caching\":\"dkzzewkfvhqcrail\",\"maxSizeInGib\":1.6355727990885582,\"maxThroughputInMbps\":69.36931359268753,\"maxIops\":67.45673093211913},{\"diskType\":\"dmhdlxyjr\",\"redundancy\":\"agafcnihgwqap\",\"size\":\"dgfbcvkcvqvpke\",\"caching\":\"cvdrhvoodsot\",\"maxSizeInGib\":43.367403188188604,\"maxThroughputInMbps\":51.562118966524096,\"maxIops\":2.765891889197103}],\"logDiskSizes\":[{\"diskType\":\"dldwmgxc\",\"redundancy\":\"slpmutwuo\",\"size\":\"rpkhjwn\",\"caching\":\"qsluicp\",\"maxSizeInGib\":8.36785423986096,\"maxThroughputInMbps\":12.17847019284215,\"maxIops\":88.04726098310458},{\"diskType\":\"paxmodfvuefywsb\",\"redundancy\":\"vmwy\",\"size\":\"fouyf\",\"caching\":\"akcp\",\"maxSizeInGib\":28.154083702502895,\"maxThroughputInMbps\":69.61685109503964,\"maxIops\":31.415267592642472},{\"diskType\":\"exkpzksmondjmq\",\"redundancy\":\"vypomgkopkwho\",\"size\":\"pajqgxysm\",\"caching\":\"mbqfqvmk\",\"maxSizeInGib\":8.63350704168877,\"maxThroughputInMbps\":52.55340906945693,\"maxIops\":82.19695982524165}],\"tempDbDiskSizes\":[{\"diskType\":\"glyatddckcbcuej\",\"redundancy\":\"xgc\",\"size\":\"ibrhosxsdqr\",\"caching\":\"o\",\"maxSizeInGib\":0.12382224769806882,\"maxThroughputInMbps\":11.035111913144524,\"maxIops\":50.18157262210079},{\"diskType\":\"hwflu\",\"redundancy\":\"dtmhrkwofyyvoqa\",\"size\":\"iexpbtgiwbwo\",\"caching\":\"washr\",\"maxSizeInGib\":49.6017449534356,\"maxThroughputInMbps\":35.52594883946759,\"maxIops\":96.32451085347836}]}") + .toObject(SkuRecommendationResultsAzureSqlVirtualMachineTargetSku.class); + Assertions.assertEquals("tppjflcx", model.category().availableVmSkus().get(0)); + Assertions.assertEquals("hhvh", model.category().virtualMachineFamily()); + Assertions.assertEquals(67653444, model.computeSize()); + Assertions.assertEquals(40.710108793520426D, model.predictedDataSizeInMb()); + Assertions.assertEquals(78.99571328023603D, model.predictedLogSizeInMb()); + Assertions.assertEquals("agxti", model.virtualMachineSize().virtualMachineFamily()); + Assertions.assertEquals("dxbx", model.virtualMachineSize().sizeName()); + Assertions.assertEquals(1137353961, model.virtualMachineSize().computeSize()); + Assertions.assertEquals("ogqxndlkzgxhuri", model.virtualMachineSize().azureSkuName()); + Assertions.assertEquals(1090180987, model.virtualMachineSize().vCPUsAvailable()); + Assertions.assertEquals(1185146175, model.virtualMachineSize().maxNetworkInterfaces()); + Assertions.assertEquals("nkbebxmuby", model.dataDiskSizes().get(0).diskType()); + Assertions.assertEquals("twlrbqt", model.dataDiskSizes().get(0).redundancy()); + Assertions.assertEquals("ievseotgqrllt", model.dataDiskSizes().get(0).size()); + Assertions.assertEquals("wlauwzizxbmpg", model.dataDiskSizes().get(0).caching()); + Assertions.assertEquals(71.0532838258196D, model.dataDiskSizes().get(0).maxSizeInGib()); + Assertions.assertEquals(95.067817287676D, model.dataDiskSizes().get(0).maxThroughputInMbps()); + Assertions.assertEquals(36.579743591782034D, model.dataDiskSizes().get(0).maxIops()); + Assertions.assertEquals("dldwmgxc", model.logDiskSizes().get(0).diskType()); + Assertions.assertEquals("slpmutwuo", model.logDiskSizes().get(0).redundancy()); + Assertions.assertEquals("rpkhjwn", model.logDiskSizes().get(0).size()); + Assertions.assertEquals("qsluicp", model.logDiskSizes().get(0).caching()); + Assertions.assertEquals(8.36785423986096D, model.logDiskSizes().get(0).maxSizeInGib()); + Assertions.assertEquals(12.17847019284215D, model.logDiskSizes().get(0).maxThroughputInMbps()); + Assertions.assertEquals(88.04726098310458D, model.logDiskSizes().get(0).maxIops()); + Assertions.assertEquals("glyatddckcbcuej", model.tempDbDiskSizes().get(0).diskType()); + Assertions.assertEquals("xgc", model.tempDbDiskSizes().get(0).redundancy()); + Assertions.assertEquals("ibrhosxsdqr", model.tempDbDiskSizes().get(0).size()); + Assertions.assertEquals("o", model.tempDbDiskSizes().get(0).caching()); + Assertions.assertEquals(0.12382224769806882D, model.tempDbDiskSizes().get(0).maxSizeInGib()); + Assertions.assertEquals(11.035111913144524D, model.tempDbDiskSizes().get(0).maxThroughputInMbps()); + Assertions.assertEquals(50.18157262210079D, model.tempDbDiskSizes().get(0).maxIops()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSizeTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSizeTests.java new file mode 100644 index 000000000000..348be2d26298 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSizeTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSizeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize model = BinaryData.fromString( + "{\"virtualMachineFamily\":\"ykojoxafnndlpic\",\"sizeName\":\"o\",\"computeSize\":1940707417,\"azureSkuName\":\"dyh\",\"vCPUsAvailable\":1262943142,\"maxNetworkInterfaces\":823230249}") + .toObject(SkuRecommendationResultsAzureSqlVirtualMachineTargetSkuVirtualMachineSize.class); + Assertions.assertEquals("ykojoxafnndlpic", model.virtualMachineFamily()); + Assertions.assertEquals("o", model.sizeName()); + Assertions.assertEquals(1940707417, model.computeSize()); + Assertions.assertEquals("dyh", model.azureSkuName()); + Assertions.assertEquals(1262943142, model.vCPUsAvailable()); + Assertions.assertEquals(823230249, model.maxNetworkInterfaces()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsMonthlyCostTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsMonthlyCostTests.java new file mode 100644 index 000000000000..6c56da371b65 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationResultsMonthlyCostTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationResultsMonthlyCost; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationResultsMonthlyCostTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationResultsMonthlyCost model = BinaryData.fromString( + "{\"computeCost\":65.73562822490665,\"storageCost\":56.124584622574936,\"iopsCost\":16.142044274716085,\"sqlLicenseCost\":2.2628806206918095,\"windowsLicenseCost\":19.9588493531773,\"totalCost\":43.17963103026587}") + .toObject(SkuRecommendationResultsMonthlyCost.class); + Assertions.assertEquals(65.73562822490665D, model.computeCost()); + Assertions.assertEquals(56.124584622574936D, model.storageCost()); + Assertions.assertEquals(16.142044274716085D, model.iopsCost()); + Assertions.assertEquals(2.2628806206918095D, model.sqlLicenseCost()); + Assertions.assertEquals(19.9588493531773D, model.windowsLicenseCost()); + Assertions.assertEquals(43.17963103026587D, model.totalCost()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationSummaryTargetSkuCategoryTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationSummaryTargetSkuCategoryTests.java new file mode 100644 index 000000000000..9e314183987e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationSummaryTargetSkuCategoryTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationSummaryTargetSkuCategory; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationSummaryTargetSkuCategoryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationSummaryTargetSkuCategory model = BinaryData.fromString( + "{\"computeTier\":\"oucqpqojx\",\"hardwareType\":\"zrzdcgd\",\"sqlPurchasingModel\":\"enribc\",\"sqlServiceTier\":\"etzqd\",\"zoneRedundancyAvailable\":true}") + .toObject(SkuRecommendationSummaryTargetSkuCategory.class); + Assertions.assertEquals("oucqpqojx", model.computeTier()); + Assertions.assertEquals("zrzdcgd", model.hardwareType()); + Assertions.assertEquals("enribc", model.sqlPurchasingModel()); + Assertions.assertEquals("etzqd", model.sqlServiceTier()); + Assertions.assertTrue(model.zoneRedundancyAvailable()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationSummaryTargetSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationSummaryTargetSkuTests.java new file mode 100644 index 000000000000..e8caa20375ff --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SkuRecommendationSummaryTargetSkuTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SkuRecommendationSummaryTargetSku; +import org.junit.jupiter.api.Assertions; + +public final class SkuRecommendationSummaryTargetSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuRecommendationSummaryTargetSku model = BinaryData.fromString( + "{\"category\":{\"computeTier\":\"ykiue\",\"hardwareType\":\"anbwzohmnrxxbso\",\"sqlPurchasingModel\":\"linhmdptysprqs\",\"sqlServiceTier\":\"zxojpslsv\",\"zoneRedundancyAvailable\":false},\"computeSize\":1732036822,\"storageMaxSizeInMb\":32.617118672163144,\"predictedDataSizeInMb\":82.45615029629619,\"predictedLogSizeInMb\":56.09550585375459,\"maxStorageIops\":51.78735229416299,\"maxThroughputMBps\":93.29740161462044}") + .toObject(SkuRecommendationSummaryTargetSku.class); + Assertions.assertEquals("ykiue", model.category().computeTier()); + Assertions.assertEquals("anbwzohmnrxxbso", model.category().hardwareType()); + Assertions.assertEquals("linhmdptysprqs", model.category().sqlPurchasingModel()); + Assertions.assertEquals("zxojpslsv", model.category().sqlServiceTier()); + Assertions.assertFalse(model.category().zoneRedundancyAvailable()); + Assertions.assertEquals(1732036822, model.computeSize()); + Assertions.assertEquals(32.617118672163144D, model.storageMaxSizeInMb()); + Assertions.assertEquals(82.45615029629619D, model.predictedDataSizeInMb()); + Assertions.assertEquals(56.09550585375459D, model.predictedLogSizeInMb()); + Assertions.assertEquals(51.78735229416299D, model.maxStorageIops()); + Assertions.assertEquals(93.29740161462044D, model.maxThroughputMBps()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabaseReplicaResourcePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabaseReplicaResourcePropertiesTests.java new file mode 100644 index 000000000000..57ccbfe9fbd1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupDatabaseReplicaResourcePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import org.junit.jupiter.api.Assertions; + +public final class SqlAvailabilityGroupDatabaseReplicaResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlAvailabilityGroupDatabaseReplicaResourceProperties model = BinaryData.fromString( + "{\"databaseName\":\"zakakankjpdn\",\"replicaName\":\"ha\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"lmuoyxprimrsopte\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"eislstvasylwx\",\"databaseStateDescription\":\"aumweoohguufu\",\"isSuspended\":true,\"suspendReasonDescription\":\"jathwtzo\"}") + .toObject(SqlAvailabilityGroupDatabaseReplicaResourceProperties.class); + Assertions.assertEquals("zakakankjpdn", model.databaseName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlAvailabilityGroupDatabaseReplicaResourceProperties model + = new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("zakakankjpdn"); + model = BinaryData.fromObject(model).toObject(SqlAvailabilityGroupDatabaseReplicaResourceProperties.class); + Assertions.assertEquals("zakakankjpdn", model.databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItemTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItemTests.java new file mode 100644 index 000000000000..e1848669c195 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItemTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import org.junit.jupiter.api.Assertions; + +public final class SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem model + = BinaryData.fromString("{\"ipAddress\":\"lcwkhihihlhz\",\"mask\":\"qtz\"}") + .toObject(SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.class); + Assertions.assertEquals("lcwkhihihlhz", model.ipAddress()); + Assertions.assertEquals("qtz", model.mask()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem model + = new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("lcwkhihihlhz") + .withMask("qtz"); + model = BinaryData.fromObject(model).toObject(SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem.class); + Assertions.assertEquals("lcwkhihihlhz", model.ipAddress()); + Assertions.assertEquals("qtz", model.mask()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicaResourcePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicaResourcePropertiesTests.java new file mode 100644 index 000000000000..70ddd146a515 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupReplicaResourcePropertiesTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import org.junit.jupiter.api.Assertions; + +public final class SqlAvailabilityGroupReplicaResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlAvailabilityGroupReplicaResourceProperties model = BinaryData.fromString( + "{\"replicaId\":\"ikvcpwp\",\"replicaName\":\"lrcivtsoxfrke\",\"replicaResourceId\":\"pmyyefrpmpdnqq\",\"configure\":{\"endpointName\":\"waoqvmmb\",\"endpointUrl\":\"qfr\",\"endpointAuthenticationMode\":\"Windows_NTLM\",\"certificateName\":\"zmegnitgvk\",\"endpointConnectLogin\":\"zyqdrfegcealzx\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"nsymoyqhlwigd\",\"failoverMode\":\"EXTERNAL\",\"failoverModeDescription\":\"bxgomfaj\",\"sessionTimeout\":1308923921,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"daeyygux\",\"secondaryAllowConnections\":\"ALL\",\"secondaryRoleAllowConnectionsDescription\":\"qzhzbezkgimsi\",\"replicaCreateDate\":\"2021-11-06T20:35:55Z\",\"replicaModifyDate\":\"2021-03-11T10:14:30Z\",\"backupPriority\":2047304515,\"readOnlyRoutingUrl\":\"vvjskgfmocwahp\",\"readWriteRoutingUrl\":\"atjeaahh\",\"seedingMode\":\"MANUAL\",\"seedingModeDescription\":\"na\"},\"state\":{\"availabilityGroupReplicaRole\":\"bbjjidjksyxk\",\"operationalStateDescription\":\"vxevblb\",\"recoveryHealthDescription\":\"dnlj\",\"synchronizationHealthDescription\":\"geuaulx\",\"connectedStateDescription\":\"smjbnkppxyn\",\"lastConnectErrorDescription\":\"lsvxeizz\",\"lastConnectErrorTimestamp\":\"2021-08-14T08:25:58Z\"}}") + .toObject(SqlAvailabilityGroupReplicaResourceProperties.class); + Assertions.assertEquals("lrcivtsoxfrke", model.replicaName()); + Assertions.assertEquals("pmyyefrpmpdnqq", model.replicaResourceId()); + Assertions.assertEquals("waoqvmmb", model.configure().endpointName()); + Assertions.assertEquals("qfr", model.configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM, model.configure().endpointAuthenticationMode()); + Assertions.assertEquals("zmegnitgvk", model.configure().certificateName()); + Assertions.assertEquals("zyqdrfegcealzx", model.configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, model.configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.EXTERNAL, model.configure().failoverMode()); + Assertions.assertEquals(1308923921, model.configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, model.configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, model.configure().secondaryAllowConnections()); + Assertions.assertEquals(2047304515, model.configure().backupPriority()); + Assertions.assertEquals("vvjskgfmocwahp", model.configure().readOnlyRoutingUrl()); + Assertions.assertEquals("atjeaahh", model.configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.MANUAL, model.configure().seedingMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlAvailabilityGroupReplicaResourceProperties model + = new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("lrcivtsoxfrke") + .withReplicaResourceId("pmyyefrpmpdnqq") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("waoqvmmb") + .withEndpointUrl("qfr") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NTLM) + .withCertificateName("zmegnitgvk") + .withEndpointConnectLogin("zyqdrfegcealzx") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.EXTERNAL) + .withSessionTimeout(1308923921) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.ALL) + .withBackupPriority(2047304515) + .withReadOnlyRoutingUrl("vvjskgfmocwahp") + .withReadWriteRoutingUrl("atjeaahh") + .withSeedingMode(SeedingMode.MANUAL)) + .withState(new AvailabilityGroupState()); + model = BinaryData.fromObject(model).toObject(SqlAvailabilityGroupReplicaResourceProperties.class); + Assertions.assertEquals("lrcivtsoxfrke", model.replicaName()); + Assertions.assertEquals("pmyyefrpmpdnqq", model.replicaResourceId()); + Assertions.assertEquals("waoqvmmb", model.configure().endpointName()); + Assertions.assertEquals("qfr", model.configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM, model.configure().endpointAuthenticationMode()); + Assertions.assertEquals("zmegnitgvk", model.configure().certificateName()); + Assertions.assertEquals("zyqdrfegcealzx", model.configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, model.configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.EXTERNAL, model.configure().failoverMode()); + Assertions.assertEquals(1308923921, model.configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, model.configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, model.configure().secondaryAllowConnections()); + Assertions.assertEquals(2047304515, model.configure().backupPriority()); + Assertions.assertEquals("vvjskgfmocwahp", model.configure().readOnlyRoutingUrl()); + Assertions.assertEquals("atjeaahh", model.configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.MANUAL, model.configure().seedingMode()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupStaticIPListenerPropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupStaticIPListenerPropertiesTests.java new file mode 100644 index 000000000000..bae3c3f3a65b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlAvailabilityGroupStaticIPListenerPropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlAvailabilityGroupStaticIPListenerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlAvailabilityGroupStaticIPListenerProperties model = BinaryData.fromString( + "{\"dnsName\":\"jvusfzldmozux\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"btkadpysownbtgkb\",\"mask\":\"rj\"},{\"ipAddress\":\"to\",\"mask\":\"mi\"}],\"ipV6Addresses\":[\"ieypef\",\"jy\",\"dh\",\"u\"],\"port\":282086138}") + .toObject(SqlAvailabilityGroupStaticIPListenerProperties.class); + Assertions.assertEquals("jvusfzldmozux", model.dnsName()); + Assertions.assertEquals("btkadpysownbtgkb", model.ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("rj", model.ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("ieypef", model.ipV6Addresses().get(0)); + Assertions.assertEquals(282086138, model.port()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlAvailabilityGroupStaticIPListenerProperties model + = new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("jvusfzldmozux") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("btkadpysownbtgkb") + .withMask("rj"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("to").withMask("mi"))) + .withIpV6Addresses(Arrays.asList("ieypef", "jy", "dh", "u")) + .withPort(282086138); + model = BinaryData.fromObject(model).toObject(SqlAvailabilityGroupStaticIPListenerProperties.class); + Assertions.assertEquals("jvusfzldmozux", model.dnsName()); + Assertions.assertEquals("btkadpysownbtgkb", model.ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("rj", model.ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("ieypef", model.ipV6Addresses().get(0)); + Assertions.assertEquals(282086138, model.port()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java deleted file mode 100644 index 64ec1d684d2e..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SRawTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SRaw; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlManagedInstanceK8SRawTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceK8SRaw model = BinaryData.fromString( - "{\"spec\":{\"scheduling\":{\"default\":{\"resources\":{\"requests\":{\"gr\":\"soifiyipjxsqw\",\"qabnmoc\":\"bznorcjxvsnby\",\"toqcjmklja\":\"cyshurzafbljjgp\"},\"limits\":{\"pku\":\"idtqajzyu\",\"gqexzlocxs\":\"jkrlkhbzhfepg\",\"bcsglumma\":\"paierh\"},\"\":{\"nbdxk\":\"dataaodxo\"}},\"\":{\"onpimexgstxg\":\"dataokaj\"}},\"\":{\"aajrm\":\"datadg\",\"clwhijcoejctbz\":\"datadjwzrlov\",\"bkbfkgukdkex\":\"dataqsqsy\",\"ocjjxhvpmouexh\":\"datappofmxaxcfjpgdd\"}},\"replicas\":9507758,\"\":{\"deicbtwnpzao\":\"dataqeojnxqbzvddntw\"}},\"\":{\"qkwpyeicxmqc\":\"datahrhcffcyddglmjth\",\"pbobjo\":\"datawqvhkhixuigdt\",\"w\":\"datahm\",\"a\":\"dataa\"}}") - .toObject(SqlManagedInstanceK8SRaw.class); - Assertions.assertEquals("soifiyipjxsqw", - model.spec().scheduling().defaultProperty().resources().requests().get("gr")); - Assertions.assertEquals("idtqajzyu", - model.spec().scheduling().defaultProperty().resources().limits().get("pku")); - Assertions.assertEquals(9507758, model.spec().replicas()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceK8SRaw model - = new SqlManagedInstanceK8SRaw() - .withSpec( - new SqlManagedInstanceK8SSpec() - .withScheduling(new K8SScheduling().withDefaultProperty(new K8SSchedulingOptions() - .withResources(new K8SResourceRequirements() - .withRequests(mapOf("gr", "soifiyipjxsqw", "qabnmoc", "bznorcjxvsnby", "toqcjmklja", - "cyshurzafbljjgp")) - .withLimits( - mapOf("pku", "idtqajzyu", "gqexzlocxs", "jkrlkhbzhfepg", "bcsglumma", "paierh")) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())).withAdditionalProperties(mapOf())) - .withReplicas(9507758) - .withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceK8SRaw.class); - Assertions.assertEquals("soifiyipjxsqw", - model.spec().scheduling().defaultProperty().resources().requests().get("gr")); - Assertions.assertEquals("idtqajzyu", - model.spec().scheduling().defaultProperty().resources().limits().get("pku")); - Assertions.assertEquals(9507758, model.spec().replicas()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java deleted file mode 100644 index ff79932ce472..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceK8SSpecTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.K8SResourceRequirements; -import com.azure.resourcemanager.azurearcdata.models.K8SScheduling; -import com.azure.resourcemanager.azurearcdata.models.K8SSchedulingOptions; -import com.azure.resourcemanager.azurearcdata.models.SqlManagedInstanceK8SSpec; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlManagedInstanceK8SSpecTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlManagedInstanceK8SSpec model = BinaryData.fromString( - "{\"scheduling\":{\"default\":{\"resources\":{\"requests\":{\"kftutqxlngxlefg\":\"vvtpgvdfgio\",\"rvqdra\":\"gnxkrxdqmidtth\",\"skanyk\":\"hjybigehoqfbo\"},\"limits\":{\"ndrvynhzg\":\"cuiywgqyw\",\"ecfvmm\":\"phrcgyncoc\",\"sxlzevgbmqj\":\"oo\",\"lzu\":\"abcypmivk\"},\"\":{\"cfionl\":\"datafwnfnb\"}},\"\":{\"qqwx\":\"dataetqgtzxdpnq\"}},\"\":{\"mpmngnzscxaqwoo\":\"dataeallnwsubisnj\",\"njeaseipheofloke\":\"datahcbonqvpkvlr\",\"enjbdlwtgrhp\":\"datay\"}},\"replicas\":469621378,\"\":{\"lhbxxhejjzzvdud\":\"datamasxazjpqyegu\",\"pwlbjnpg\":\"datawdslfhotwmcy\",\"nltyfsoppusuesnz\":\"datacftadeh\"}}") - .toObject(SqlManagedInstanceK8SSpec.class); - Assertions.assertEquals("vvtpgvdfgio", - model.scheduling().defaultProperty().resources().requests().get("kftutqxlngxlefg")); - Assertions.assertEquals("cuiywgqyw", - model.scheduling().defaultProperty().resources().limits().get("ndrvynhzg")); - Assertions.assertEquals(469621378, model.replicas()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlManagedInstanceK8SSpec model - = new SqlManagedInstanceK8SSpec() - .withScheduling( - new K8SScheduling() - .withDefaultProperty(new K8SSchedulingOptions().withResources(new K8SResourceRequirements() - .withRequests(mapOf("kftutqxlngxlefg", "vvtpgvdfgio", "rvqdra", "gnxkrxdqmidtth", "skanyk", - "hjybigehoqfbo")) - .withLimits(mapOf("ndrvynhzg", "cuiywgqyw", "ecfvmm", "phrcgyncoc", "sxlzevgbmqj", "oo", - "lzu", "abcypmivk")) - .withAdditionalProperties(mapOf())).withAdditionalProperties(mapOf())) - .withAdditionalProperties(mapOf())) - .withReplicas(469621378) - .withAdditionalProperties(mapOf()); - model = BinaryData.fromObject(model).toObject(SqlManagedInstanceK8SSpec.class); - Assertions.assertEquals("vvtpgvdfgio", - model.scheduling().defaultProperty().resources().requests().get("kftutqxlngxlefg")); - Assertions.assertEquals("cuiywgqyw", - model.scheduling().defaultProperty().resources().limits().get("ndrvynhzg")); - Assertions.assertEquals(469621378, model.replicas()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java index 3ac17c911852..dce9d16f53d5 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceSkuTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -13,27 +13,27 @@ public final class SqlManagedInstanceSkuTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SqlManagedInstanceSku model = BinaryData.fromString( - "{\"tier\":\"GeneralPurpose\",\"dev\":true,\"size\":\"cohoq\",\"family\":\"wvl\",\"capacity\":137418501}") + "{\"tier\":\"GeneralPurpose\",\"dev\":false,\"size\":\"zwtruwiqzbqjvsov\",\"family\":\"okacspk\",\"capacity\":1932691851}") .toObject(SqlManagedInstanceSku.class); Assertions.assertEquals(SqlManagedInstanceSkuTier.GENERAL_PURPOSE, model.tier()); - Assertions.assertEquals(true, model.dev()); - Assertions.assertEquals("cohoq", model.size()); - Assertions.assertEquals("wvl", model.family()); - Assertions.assertEquals(137418501, model.capacity()); + Assertions.assertFalse(model.dev()); + Assertions.assertEquals("zwtruwiqzbqjvsov", model.size()); + Assertions.assertEquals("okacspk", model.family()); + Assertions.assertEquals(1932691851, model.capacity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SqlManagedInstanceSku model = new SqlManagedInstanceSku().withTier(SqlManagedInstanceSkuTier.GENERAL_PURPOSE) - .withDev(true) - .withSize("cohoq") - .withFamily("wvl") - .withCapacity(137418501); + .withDev(false) + .withSize("zwtruwiqzbqjvsov") + .withFamily("okacspk") + .withCapacity(1932691851); model = BinaryData.fromObject(model).toObject(SqlManagedInstanceSku.class); Assertions.assertEquals(SqlManagedInstanceSkuTier.GENERAL_PURPOSE, model.tier()); - Assertions.assertEquals(true, model.dev()); - Assertions.assertEquals("cohoq", model.size()); - Assertions.assertEquals("wvl", model.family()); - Assertions.assertEquals(137418501, model.capacity()); + Assertions.assertFalse(model.dev()); + Assertions.assertEquals("zwtruwiqzbqjvsov", model.size()); + Assertions.assertEquals("okacspk", model.family()); + Assertions.assertEquals(1932691851, model.capacity()); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java index 454403d12fa9..028b7040d327 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstanceUpdateTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -13,16 +13,18 @@ public final class SqlManagedInstanceUpdateTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - SqlManagedInstanceUpdate model = BinaryData.fromString("{\"tags\":{\"konocu\":\"hheunmmqhgyx\"}}") + SqlManagedInstanceUpdate model = BinaryData.fromString( + "{\"tags\":{\"hrk\":\"obpxjmflbvvn\",\"ajiwkuo\":\"ciwwzjuqkhr\",\"sauuimj\":\"oskg\",\"rfbyaosvexcso\":\"vxieduugidyj\"}}") .toObject(SqlManagedInstanceUpdate.class); - Assertions.assertEquals("hheunmmqhgyx", model.tags().get("konocu")); + Assertions.assertEquals("obpxjmflbvvn", model.tags().get("hrk")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SqlManagedInstanceUpdate model = new SqlManagedInstanceUpdate().withTags(mapOf("konocu", "hheunmmqhgyx")); + SqlManagedInstanceUpdate model = new SqlManagedInstanceUpdate().withTags( + mapOf("hrk", "obpxjmflbvvn", "ajiwkuo", "ciwwzjuqkhr", "sauuimj", "oskg", "rfbyaosvexcso", "vxieduugidyj")); model = BinaryData.fromObject(model).toObject(SqlManagedInstanceUpdate.class); - Assertions.assertEquals("hheunmmqhgyx", model.tags().get("konocu")); + Assertions.assertEquals("obpxjmflbvvn", model.tags().get("hrk")); } // Use "Map.of" if available diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java index a8e46dbc7dea..0db5ec42c5f4 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlManagedInstancesDeleteMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDelete() throws Exception { AzureArcDataManager manager = AzureArcDataManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - manager.sqlManagedInstances().delete("mnvdfzn", "daodvxzbncblyl", com.azure.core.util.Context.NONE); + manager.sqlManagedInstances().delete("bapxkiyfjjkb", "jbuscg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourceInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourceInnerTests.java new file mode 100644 index 000000000000..97547976fca8 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourceInnerTests.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerAvailabilityGroupResourceInner; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerAvailabilityGroupResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerAvailabilityGroupResourceInner model = BinaryData.fromString( + "{\"properties\":{\"availabilityGroupId\":\"mfwdgzxu\",\"serverName\":\"cvpa\",\"instanceName\":\"sreuzvxurisjnh\",\"vmId\":\"txifqj\",\"collectionTimestamp\":\"2020-12-30T22:59:48Z\",\"info\":{\"failureConditionLevel\":466786875,\"healthCheckTimeout\":912922053,\"automatedBackupPreferenceDescription\":\"wp\",\"version\":1928242324,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":false,\"isDistributed\":true,\"clusterTypeDescription\":\"utpwoqhihejqgw\",\"requiredSynchronizedSecondariesToCommit\":938622806,\"isContained\":true,\"primaryReplica\":\"tcypsxjvfoim\",\"primaryRecoveryHealthDescription\":\"slirciz\",\"secondaryRecoveryHealthDescription\":\"vydfceacvlhvygdy\",\"synchronizationHealthDescription\":\"umrtwnawjsl\",\"replicationPartnerType\":\"Unknown\",\"listener\":{\"dnsName\":\"jgcyztsfmznba\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"chqnrnrpxehuwry\",\"mask\":\"gaifmvik\"}],\"ipV6Addresses\":[\"dvk\"],\"port\":741141390}},\"replicas\":{\"value\":[{\"replicaId\":\"xcv\",\"replicaName\":\"rhnj\",\"replicaResourceId\":\"olvtnovqfzge\",\"configure\":{\"endpointName\":\"ftul\",\"endpointUrl\":\"tduceamt\",\"endpointAuthenticationMode\":\"Windows_NTLM_Certificate\",\"certificateName\":\"o\",\"endpointConnectLogin\":\"jw\",\"availabilityMode\":\"SYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"ioknssxmoj\",\"failoverMode\":\"MANUAL\",\"failoverModeDescription\":\"kjprvk\",\"sessionTimeout\":524680213,\"primaryAllowConnections\":\"ALL\",\"primaryRoleAllowConnectionsDescription\":\"jyxgtczh\",\"secondaryAllowConnections\":\"ALL\",\"secondaryRoleAllowConnectionsDescription\":\"sdshmkxmaehvb\",\"replicaCreateDate\":\"2021-10-19T14:45:47Z\",\"replicaModifyDate\":\"2021-02-13T12:11:55Z\",\"backupPriority\":874326134,\"readOnlyRoutingUrl\":\"fnhtbaxkgxyw\",\"readWriteRoutingUrl\":\"kpyklyhp\",\"seedingMode\":\"MANUAL\",\"seedingModeDescription\":\"pvruudlg\"},\"state\":{\"availabilityGroupReplicaRole\":\"thost\",\"operationalStateDescription\":\"tstvdxeclzedq\",\"recoveryHealthDescription\":\"vh\",\"synchronizationHealthDescription\":\"h\",\"connectedStateDescription\":\"odqkdlwwqfb\",\"lastConnectErrorDescription\":\"lkxt\",\"lastConnectErrorTimestamp\":\"2021-08-17T05:09:37Z\"}},{\"replicaId\":\"mlmbtxhwgfwsrta\",\"replicaName\":\"oezbrhubsk\",\"replicaResourceId\":\"dyg\",\"configure\":{\"endpointName\":\"kkqfqjbvle\",\"endpointUrl\":\"fmluiqtqzfavyvn\",\"endpointAuthenticationMode\":\"Windows_Negotiate_Certificate\",\"certificateName\":\"aryeu\",\"endpointConnectLogin\":\"jkqa\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"slesjcbhernnt\",\"failoverMode\":\"AUTOMATIC\",\"failoverModeDescription\":\"jcvb\",\"sessionTimeout\":440184617,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"hwagohbuffkmrqe\",\"secondaryAllowConnections\":\"NO\",\"secondaryRoleAllowConnectionsDescription\":\"mxtd\",\"replicaCreateDate\":\"2021-01-18T23:42:59Z\",\"replicaModifyDate\":\"2021-06-23T19:55:26Z\",\"backupPriority\":730644177,\"readOnlyRoutingUrl\":\"ebjvewzcjzn\",\"readWriteRoutingUrl\":\"cpmguaadraufact\",\"seedingMode\":\"AUTOMATIC\",\"seedingModeDescription\":\"ovajjziuxxps\"},\"state\":{\"availabilityGroupReplicaRole\":\"e\",\"operationalStateDescription\":\"lfg\",\"recoveryHealthDescription\":\"qubkw\",\"synchronizationHealthDescription\":\"enr\",\"connectedStateDescription\":\"utujba\",\"lastConnectErrorDescription\":\"juohminyflnorw\",\"lastConnectErrorTimestamp\":\"2021-02-09T18:43:47Z\"}}],\"nextLink\":\"wpklvxw\"},\"databases\":{\"value\":[{\"databaseName\":\"pgpqchiszepnnb\",\"replicaName\":\"rxgibbd\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"ozauorsukokwb\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"lvnuuepzlrph\",\"databaseStateDescription\":\"soldweyuqdunv\",\"isSuspended\":true,\"suspendReasonDescription\":\"wrbiorkt\"},{\"databaseName\":\"ywjhhgdnhx\",\"replicaName\":\"ivfomiloxgg\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"dieuzaofj\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"yyysfgdotcubi\",\"databaseStateDescription\":\"uipwoqonmacje\",\"isSuspended\":false,\"suspendReasonDescription\":\"shqvcimpev\"},{\"databaseName\":\"mblrrilbywd\",\"replicaName\":\"miccwrwfscjfnyn\",\"isLocal\":false,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"zdvoqytibyowbb\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"vutpthjoxo\",\"databaseStateDescription\":\"msksbp\",\"isSuspended\":false,\"suspendReasonDescription\":\"oljxkcgx\"},{\"databaseName\":\"xsffgcviz\",\"replicaName\":\"dwl\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"pfgfbkjub\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"kfm\",\"databaseStateDescription\":\"sgow\",\"isSuspended\":true,\"suspendReasonDescription\":\"sttktlahbqa\"}],\"nextLink\":\"xtgzukxitmmqtgqq\"},\"provisioningState\":\"hrnxrxc\"},\"location\":\"uisavokq\",\"tags\":{\"ttbaj\":\"vazivjlfr\",\"pidkqqfkuvscxkdm\":\"katnwxyi\",\"rxkpmloazuruoc\":\"igovi\",\"bfhjxakvvjgsl\":\"goorbteo\"},\"id\":\"r\",\"name\":\"il\",\"type\":\"yw\"}") + .toObject(SqlServerAvailabilityGroupResourceInner.class); + Assertions.assertEquals("uisavokq", model.location()); + Assertions.assertEquals("vazivjlfr", model.tags().get("ttbaj")); + Assertions.assertEquals(466786875, model.properties().info().failureConditionLevel()); + Assertions.assertEquals(912922053, model.properties().info().healthCheckTimeout()); + Assertions.assertTrue(model.properties().info().basicFeatures()); + Assertions.assertFalse(model.properties().info().dtcSupport()); + Assertions.assertFalse(model.properties().info().dbFailover()); + Assertions.assertTrue(model.properties().info().isDistributed()); + Assertions.assertEquals(938622806, model.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(model.properties().info().isContained()); + Assertions.assertEquals("jgcyztsfmznba", model.properties().info().listener().dnsName()); + Assertions.assertEquals("chqnrnrpxehuwry", + model.properties().info().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("gaifmvik", model.properties().info().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("dvk", model.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(741141390, model.properties().info().listener().port()); + Assertions.assertEquals("rhnj", model.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("olvtnovqfzge", model.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("ftul", model.properties().replicas().value().get(0).configure().endpointName()); + Assertions.assertEquals("tduceamt", model.properties().replicas().value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM_CERTIFICATE, + model.properties().replicas().value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("o", model.properties().replicas().value().get(0).configure().certificateName()); + Assertions.assertEquals("jw", model.properties().replicas().value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, + model.properties().replicas().value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.properties().replicas().value().get(0).configure().failoverMode()); + Assertions.assertEquals(524680213, model.properties().replicas().value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, + model.properties().replicas().value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, + model.properties().replicas().value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(874326134, model.properties().replicas().value().get(0).configure().backupPriority()); + Assertions.assertEquals("fnhtbaxkgxyw", + model.properties().replicas().value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("kpyklyhp", + model.properties().replicas().value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.MANUAL, + model.properties().replicas().value().get(0).configure().seedingMode()); + Assertions.assertEquals("pgpqchiszepnnb", model.properties().databases().value().get(0).databaseName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerAvailabilityGroupResourceInner model + = new SqlServerAvailabilityGroupResourceInner().withLocation("uisavokq") + .withTags(mapOf("ttbaj", "vazivjlfr", "pidkqqfkuvscxkdm", "katnwxyi", "rxkpmloazuruoc", "igovi", + "bfhjxakvvjgsl", "goorbteo")) + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withInfo( + new AvailabilityGroupInfo().withFailureConditionLevel(466786875) + .withHealthCheckTimeout(912922053) + .withBasicFeatures(true) + .withDtcSupport(false) + .withDbFailover(false) + .withIsDistributed(true) + .withRequiredSynchronizedSecondariesToCommit(938622806) + .withIsContained(true) + .withListener( + new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("jgcyztsfmznba") + .withIpV4AddressesAndMasks( + Arrays.asList(new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() + .withIpAddress("chqnrnrpxehuwry") + .withMask("gaifmvik"))) + .withIpV6Addresses(Arrays.asList("dvk")) + .withPort(741141390))) + .withReplicas( + new SqlServerAvailabilityGroupResourcePropertiesReplicas() + .withValue( + Arrays + .asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("rhnj") + .withReplicaResourceId("olvtnovqfzge") + .withConfigure(new AvailabilityGroupConfigure() + .withEndpointName("ftul") + .withEndpointUrl("tduceamt") + .withEndpointAuthenticationMode( + ConnectionAuth.WINDOWS_NTLM_CERTIFICATE) + .withCertificateName("o") + .withEndpointConnectLogin("jw") + .withAvailabilityMode( + ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSessionTimeout(524680213) + .withPrimaryAllowConnections(PrimaryAllowConnections.ALL) + .withSecondaryAllowConnections(SecondaryAllowConnections.ALL) + .withBackupPriority(874326134) + .withReadOnlyRoutingUrl("fnhtbaxkgxyw") + .withReadWriteRoutingUrl("kpyklyhp") + .withSeedingMode(SeedingMode.MANUAL)) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties() + .withReplicaName("oezbrhubsk") + .withReplicaResourceId("dyg") + .withConfigure( + new AvailabilityGroupConfigure().withEndpointName("kkqfqjbvle") + .withEndpointUrl("fmluiqtqzfavyvn") + .withEndpointAuthenticationMode( + ConnectionAuth.WINDOWS_NEGOTIATE_CERTIFICATE) + .withCertificateName("aryeu") + .withEndpointConnectLogin("jkqa") + .withAvailabilityMode( + ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSessionTimeout(440184617) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.NO) + .withBackupPriority(730644177) + .withReadOnlyRoutingUrl("ebjvewzcjzn") + .withReadWriteRoutingUrl("cpmguaadraufact") + .withSeedingMode(SeedingMode.AUTOMATIC)) + .withState(new AvailabilityGroupState())))) + .withDatabases( + new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("pgpqchiszepnnb"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("ywjhhgdnhx"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("mblrrilbywd"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("xsffgcviz"))))); + model = BinaryData.fromObject(model).toObject(SqlServerAvailabilityGroupResourceInner.class); + Assertions.assertEquals("uisavokq", model.location()); + Assertions.assertEquals("vazivjlfr", model.tags().get("ttbaj")); + Assertions.assertEquals(466786875, model.properties().info().failureConditionLevel()); + Assertions.assertEquals(912922053, model.properties().info().healthCheckTimeout()); + Assertions.assertTrue(model.properties().info().basicFeatures()); + Assertions.assertFalse(model.properties().info().dtcSupport()); + Assertions.assertFalse(model.properties().info().dbFailover()); + Assertions.assertTrue(model.properties().info().isDistributed()); + Assertions.assertEquals(938622806, model.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(model.properties().info().isContained()); + Assertions.assertEquals("jgcyztsfmznba", model.properties().info().listener().dnsName()); + Assertions.assertEquals("chqnrnrpxehuwry", + model.properties().info().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("gaifmvik", model.properties().info().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("dvk", model.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(741141390, model.properties().info().listener().port()); + Assertions.assertEquals("rhnj", model.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("olvtnovqfzge", model.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("ftul", model.properties().replicas().value().get(0).configure().endpointName()); + Assertions.assertEquals("tduceamt", model.properties().replicas().value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.WINDOWS_NTLM_CERTIFICATE, + model.properties().replicas().value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("o", model.properties().replicas().value().get(0).configure().certificateName()); + Assertions.assertEquals("jw", model.properties().replicas().value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT, + model.properties().replicas().value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.properties().replicas().value().get(0).configure().failoverMode()); + Assertions.assertEquals(524680213, model.properties().replicas().value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.ALL, + model.properties().replicas().value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.ALL, + model.properties().replicas().value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(874326134, model.properties().replicas().value().get(0).configure().backupPriority()); + Assertions.assertEquals("fnhtbaxkgxyw", + model.properties().replicas().value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("kpyklyhp", + model.properties().replicas().value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.MANUAL, + model.properties().replicas().value().get(0).configure().seedingMode()); + Assertions.assertEquals("pgpqchiszepnnb", model.properties().databases().value().get(0).databaseName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesDatabasesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesDatabasesTests.java new file mode 100644 index 000000000000..a458e1d773ab --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesDatabasesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerAvailabilityGroupResourcePropertiesDatabasesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerAvailabilityGroupResourcePropertiesDatabases model = BinaryData.fromString( + "{\"value\":[{\"databaseName\":\"rzvul\",\"replicaName\":\"aaeranokqgukk\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"oylaxxul\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"dosfjbjsvgjrw\",\"databaseStateDescription\":\"yvycytdclxgcckn\",\"isSuspended\":true,\"suspendReasonDescription\":\"btmvpdvjdhttza\"},{\"databaseName\":\"edxihchrphkmcrj\",\"replicaName\":\"nsdfzpbgtgky\",\"isLocal\":false,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"jeuut\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"z\",\"databaseStateDescription\":\"hokvbwnh\",\"isSuspended\":false,\"suspendReasonDescription\":\"gehgppi\"},{\"databaseName\":\"fhpfeoajvgcxtx\",\"replicaName\":\"sheafid\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"esmkssjhoiftxfkf\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"rhptilluc\",\"databaseStateDescription\":\"qtgdqohmcwsl\",\"isSuspended\":false,\"suspendReasonDescription\":\"etpwbralll\"}],\"nextLink\":\"phbqz\"}") + .toObject(SqlServerAvailabilityGroupResourcePropertiesDatabases.class); + Assertions.assertEquals("rzvul", model.value().get(0).databaseName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerAvailabilityGroupResourcePropertiesDatabases model + = new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue( + Arrays.asList(new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("rzvul"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("edxihchrphkmcrj"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("fhpfeoajvgcxtx"))); + model = BinaryData.fromObject(model).toObject(SqlServerAvailabilityGroupResourcePropertiesDatabases.class); + Assertions.assertEquals("rzvul", model.value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesReplicasTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesReplicasTests.java new file mode 100644 index 000000000000..197f4dad017d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesReplicasTests.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerAvailabilityGroupResourcePropertiesReplicasTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerAvailabilityGroupResourcePropertiesReplicas model = BinaryData.fromString( + "{\"value\":[{\"replicaId\":\"nowc\",\"replicaName\":\"fgmvecactxmwo\",\"replicaResourceId\":\"yowc\",\"configure\":{\"endpointName\":\"ovekqvgqouwi\",\"endpointUrl\":\"mpjw\",\"endpointAuthenticationMode\":\"Certificate_Windows_Kerberos\",\"certificateName\":\"ikf\",\"endpointConnectLogin\":\"vhrfsphuagrt\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"eusqczkvyklxu\",\"failoverMode\":\"NONE\",\"failoverModeDescription\":\"ff\",\"sessionTimeout\":1173878912,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"qcuubgqibrta\",\"secondaryAllowConnections\":\"READ_ONLY\",\"secondaryRoleAllowConnectionsDescription\":\"ttwgdsl\",\"replicaCreateDate\":\"2021-06-19T08:41:21Z\",\"replicaModifyDate\":\"2021-03-30T18:43:15Z\",\"backupPriority\":719469590,\"readOnlyRoutingUrl\":\"oi\",\"readWriteRoutingUrl\":\"seypxiutcxapz\",\"seedingMode\":\"MANUAL\",\"seedingModeDescription\":\"etoge\"},\"state\":{\"availabilityGroupReplicaRole\":\"xslhvnhlabrqnkk\",\"operationalStateDescription\":\"cjbtrgaehvvib\",\"recoveryHealthDescription\":\"jj\",\"synchronizationHealthDescription\":\"oqbeitpkxzt\",\"connectedStateDescription\":\"ob\",\"lastConnectErrorDescription\":\"ft\",\"lastConnectErrorTimestamp\":\"2021-09-03T03:39:31Z\"}},{\"replicaId\":\"cwq\",\"replicaName\":\"imaq\",\"replicaResourceId\":\"hemjy\",\"configure\":{\"endpointName\":\"uj\",\"endpointUrl\":\"t\",\"endpointAuthenticationMode\":\"Windows_Negotiate_Certificate\",\"certificateName\":\"zwculkbawpfajnj\",\"endpointConnectLogin\":\"tlwtjjguktalhsn\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"mxzrpoa\",\"failoverMode\":\"EXTERNAL\",\"failoverModeDescription\":\"wiaaomylweaz\",\"sessionTimeout\":670464675,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"hwwn\",\"secondaryAllowConnections\":\"READ_ONLY\",\"secondaryRoleAllowConnectionsDescription\":\"fz\",\"replicaCreateDate\":\"2021-04-13T21:57:14Z\",\"replicaModifyDate\":\"2021-07-06T19:56:22Z\",\"backupPriority\":1831008288,\"readOnlyRoutingUrl\":\"fb\",\"readWriteRoutingUrl\":\"snfepgfewetwlyx\",\"seedingMode\":\"AUTOMATIC\",\"seedingModeDescription\":\"ykxhdjh\"},\"state\":{\"availabilityGroupReplicaRole\":\"mbcxfhbcp\",\"operationalStateDescription\":\"xvxcjzhq\",\"recoveryHealthDescription\":\"xfpxtgqscja\",\"synchronizationHealthDescription\":\"t\",\"connectedStateDescription\":\"hdqazkmtgguwp\",\"lastConnectErrorDescription\":\"r\",\"lastConnectErrorTimestamp\":\"2021-11-12T08:33:33Z\"}},{\"replicaId\":\"vmmghfcfiwrxgk\",\"replicaName\":\"uvyinzqodfvpgs\",\"replicaResourceId\":\"xgsg\",\"configure\":{\"endpointName\":\"gzdjtxvzf\",\"endpointUrl\":\"q\",\"endpointAuthenticationMode\":\"Windows_NTLM\",\"certificateName\":\"vl\",\"endpointConnectLogin\":\"fcq\",\"availabilityMode\":\"SYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"vetnwsdtutn\",\"failoverMode\":\"AUTOMATIC\",\"failoverModeDescription\":\"ycvuzhyrmewipmv\",\"sessionTimeout\":1907167908,\"primaryAllowConnections\":\"ALL\",\"primaryRoleAllowConnectionsDescription\":\"uqgsj\",\"secondaryAllowConnections\":\"NO\",\"secondaryRoleAllowConnectionsDescription\":\"dxgketwzhhzjhfj\",\"replicaCreateDate\":\"2021-06-18T08:42:37Z\",\"replicaModifyDate\":\"2021-06-30T13:43:03Z\",\"backupPriority\":1386736873,\"readOnlyRoutingUrl\":\"pmuneqsx\",\"readWriteRoutingUrl\":\"hfbuzjyihsasbhud\",\"seedingMode\":\"MANUAL\",\"seedingModeDescription\":\"yue\"},\"state\":{\"availabilityGroupReplicaRole\":\"ynsqyrpfoobr\",\"operationalStateDescription\":\"tyms\",\"recoveryHealthDescription\":\"ygqdnfwqzdz\",\"synchronizationHealthDescription\":\"ilaxhn\",\"connectedStateDescription\":\"qlyvijo\",\"lastConnectErrorDescription\":\"iv\",\"lastConnectErrorTimestamp\":\"2021-07-27T23:48:23Z\"}}],\"nextLink\":\"zunbixx\"}") + .toObject(SqlServerAvailabilityGroupResourcePropertiesReplicas.class); + Assertions.assertEquals("fgmvecactxmwo", model.value().get(0).replicaName()); + Assertions.assertEquals("yowc", model.value().get(0).replicaResourceId()); + Assertions.assertEquals("ovekqvgqouwi", model.value().get(0).configure().endpointName()); + Assertions.assertEquals("mpjw", model.value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("ikf", model.value().get(0).configure().certificateName()); + Assertions.assertEquals("vhrfsphuagrt", model.value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.NONE, model.value().get(0).configure().failoverMode()); + Assertions.assertEquals(1173878912, model.value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, + model.value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.READ_ONLY, + model.value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(719469590, model.value().get(0).configure().backupPriority()); + Assertions.assertEquals("oi", model.value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("seypxiutcxapz", model.value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.MANUAL, model.value().get(0).configure().seedingMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerAvailabilityGroupResourcePropertiesReplicas model + = new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue(Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("fgmvecactxmwo") + .withReplicaResourceId("yowc") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("ovekqvgqouwi") + .withEndpointUrl("mpjw") + .withEndpointAuthenticationMode(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS) + .withCertificateName("ikf") + .withEndpointConnectLogin("vhrfsphuagrt") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSessionTimeout(1173878912) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withBackupPriority(719469590) + .withReadOnlyRoutingUrl("oi") + .withReadWriteRoutingUrl("seypxiutcxapz") + .withSeedingMode(SeedingMode.MANUAL)) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("imaq") + .withReplicaResourceId("hemjy") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("uj") + .withEndpointUrl("t") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NEGOTIATE_CERTIFICATE) + .withCertificateName("zwculkbawpfajnj") + .withEndpointConnectLogin("tlwtjjguktalhsn") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.EXTERNAL) + .withSessionTimeout(670464675) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withBackupPriority(1831008288) + .withReadOnlyRoutingUrl("fb") + .withReadWriteRoutingUrl("snfepgfewetwlyx") + .withSeedingMode(SeedingMode.AUTOMATIC)) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("uvyinzqodfvpgs") + .withReplicaResourceId("xgsg") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("gzdjtxvzf") + .withEndpointUrl("q") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NTLM) + .withCertificateName("vl") + .withEndpointConnectLogin("fcq") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSessionTimeout(1907167908) + .withPrimaryAllowConnections(PrimaryAllowConnections.ALL) + .withSecondaryAllowConnections(SecondaryAllowConnections.NO) + .withBackupPriority(1386736873) + .withReadOnlyRoutingUrl("pmuneqsx") + .withReadWriteRoutingUrl("hfbuzjyihsasbhud") + .withSeedingMode(SeedingMode.MANUAL)) + .withState(new AvailabilityGroupState()))); + model = BinaryData.fromObject(model).toObject(SqlServerAvailabilityGroupResourcePropertiesReplicas.class); + Assertions.assertEquals("fgmvecactxmwo", model.value().get(0).replicaName()); + Assertions.assertEquals("yowc", model.value().get(0).replicaResourceId()); + Assertions.assertEquals("ovekqvgqouwi", model.value().get(0).configure().endpointName()); + Assertions.assertEquals("mpjw", model.value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("ikf", model.value().get(0).configure().certificateName()); + Assertions.assertEquals("vhrfsphuagrt", model.value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.NONE, model.value().get(0).configure().failoverMode()); + Assertions.assertEquals(1173878912, model.value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, + model.value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.READ_ONLY, + model.value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(719469590, model.value().get(0).configure().backupPriority()); + Assertions.assertEquals("oi", model.value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("seypxiutcxapz", model.value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.MANUAL, model.value().get(0).configure().seedingMode()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesTests.java new file mode 100644 index 000000000000..80f9605fafb4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupResourcePropertiesTests.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerAvailabilityGroupResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerAvailabilityGroupResourceProperties model = BinaryData.fromString( + "{\"availabilityGroupId\":\"kgkxn\",\"serverName\":\"dabg\",\"instanceName\":\"udtjuewbc\",\"vmId\":\"xuuwhcj\",\"collectionTimestamp\":\"2021-05-11T16:18:11Z\",\"info\":{\"failureConditionLevel\":1025144220,\"healthCheckTimeout\":1940459602,\"automatedBackupPreferenceDescription\":\"yakk\",\"version\":284034978,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":false,\"isDistributed\":false,\"clusterTypeDescription\":\"gstcyohpf\",\"requiredSynchronizedSecondariesToCommit\":1969491549,\"isContained\":false,\"primaryReplica\":\"dg\",\"primaryRecoveryHealthDescription\":\"gsj\",\"secondaryRecoveryHealthDescription\":\"nwqjnoba\",\"synchronizationHealthDescription\":\"hdd\",\"replicationPartnerType\":\"AzureSQLManagedInstance\",\"listener\":{\"dnsName\":\"gfnmntfpmvmemfnc\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"vbalxlllc\",\"mask\":\"odbzevwrdnhf\"}],\"ipV6Addresses\":[\"vsjcswsmystuluqy\"],\"port\":1885440426}},\"replicas\":{\"value\":[{\"replicaId\":\"chpqbmfpjba\",\"replicaName\":\"idfcxsspuunnoxyh\",\"replicaResourceId\":\"g\",\"configure\":{\"endpointName\":\"rihpfhoq\",\"endpointUrl\":\"a\",\"endpointAuthenticationMode\":\"Certificate_Windows_Kerberos\",\"certificateName\":\"omdjvlpjxxkzbrm\",\"endpointConnectLogin\":\"eivsiykzkdnc\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"nbzoggcu\",\"failoverMode\":\"AUTOMATIC\",\"failoverModeDescription\":\"wyrpgogtqxepnyl\",\"sessionTimeout\":1449086974,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"yjt\",\"secondaryAllowConnections\":\"NO\",\"secondaryRoleAllowConnectionsDescription\":\"qzhv\",\"replicaCreateDate\":\"2021-08-22T01:24:46Z\",\"replicaModifyDate\":\"2021-08-18T06:30:53Z\",\"backupPriority\":1838892910,\"readOnlyRoutingUrl\":\"wuxrkjpvdwxfzwi\",\"readWriteRoutingUrl\":\"wzjbh\",\"seedingMode\":\"AUTOMATIC\",\"seedingModeDescription\":\"jrkambtrnegvmnv\"},\"state\":{\"availabilityGroupReplicaRole\":\"qvldspastjbkkd\",\"operationalStateDescription\":\"lves\",\"recoveryHealthDescription\":\"jlxr\",\"synchronizationHealthDescription\":\"lozapeewchpxlk\",\"connectedStateDescription\":\"kuziycsle\",\"lastConnectErrorDescription\":\"f\",\"lastConnectErrorTimestamp\":\"2021-03-03T22:41:41Z\"}}],\"nextLink\":\"ktyhjt\"},\"databases\":{\"value\":[{\"databaseName\":\"zulwmmrqzzrrj\",\"replicaName\":\"gl\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"vqeevtoep\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"nwy\",\"databaseStateDescription\":\"zdmovzv\",\"isSuspended\":true,\"suspendReasonDescription\":\"wzqa\"},{\"databaseName\":\"lgzurig\",\"replicaName\":\"ecxn\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"pvz\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"mldgxobfirc\",\"databaseStateDescription\":\"pkc\",\"isSuspended\":false,\"suspendReasonDescription\":\"riykhyawfvjlbox\"},{\"databaseName\":\"kjlmx\",\"replicaName\":\"mdy\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"gumbnraauzzptja\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"zhezwwvaiq\",\"databaseStateDescription\":\"vv\",\"isSuspended\":false,\"suspendReasonDescription\":\"p\"},{\"databaseName\":\"qyikvy\",\"replicaName\":\"uyav\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"sttijfybvp\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"sgsgbdhu\",\"databaseStateDescription\":\"gnjdgkynscliqhz\",\"isSuspended\":true,\"suspendReasonDescription\":\"komtkubotppn\"}],\"nextLink\":\"xz\"},\"provisioningState\":\"ihfrbbcevqa\"}") + .toObject(SqlServerAvailabilityGroupResourceProperties.class); + Assertions.assertEquals(1025144220, model.info().failureConditionLevel()); + Assertions.assertEquals(1940459602, model.info().healthCheckTimeout()); + Assertions.assertTrue(model.info().basicFeatures()); + Assertions.assertFalse(model.info().dtcSupport()); + Assertions.assertFalse(model.info().dbFailover()); + Assertions.assertFalse(model.info().isDistributed()); + Assertions.assertEquals(1969491549, model.info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(model.info().isContained()); + Assertions.assertEquals("gfnmntfpmvmemfnc", model.info().listener().dnsName()); + Assertions.assertEquals("vbalxlllc", model.info().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("odbzevwrdnhf", model.info().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("vsjcswsmystuluqy", model.info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1885440426, model.info().listener().port()); + Assertions.assertEquals("idfcxsspuunnoxyh", model.replicas().value().get(0).replicaName()); + Assertions.assertEquals("g", model.replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("rihpfhoq", model.replicas().value().get(0).configure().endpointName()); + Assertions.assertEquals("a", model.replicas().value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.replicas().value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("omdjvlpjxxkzbrm", model.replicas().value().get(0).configure().certificateName()); + Assertions.assertEquals("eivsiykzkdnc", model.replicas().value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.replicas().value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, + model.replicas().value().get(0).configure().failoverMode()); + Assertions.assertEquals(1449086974, model.replicas().value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, + model.replicas().value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.NO, + model.replicas().value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(1838892910, model.replicas().value().get(0).configure().backupPriority()); + Assertions.assertEquals("wuxrkjpvdwxfzwi", model.replicas().value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("wzjbh", model.replicas().value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.replicas().value().get(0).configure().seedingMode()); + Assertions.assertEquals("zulwmmrqzzrrj", model.databases().value().get(0).databaseName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerAvailabilityGroupResourceProperties model = new SqlServerAvailabilityGroupResourceProperties() + .withInfo(new AvailabilityGroupInfo().withFailureConditionLevel(1025144220) + .withHealthCheckTimeout(1940459602) + .withBasicFeatures(true) + .withDtcSupport(false) + .withDbFailover(false) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(1969491549) + .withIsContained(false) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("gfnmntfpmvmemfnc") + .withIpV4AddressesAndMasks(Arrays + .asList(new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("vbalxlllc") + .withMask("odbzevwrdnhf"))) + .withIpV6Addresses(Arrays.asList("vsjcswsmystuluqy")) + .withPort(1885440426))) + .withReplicas(new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue( + Arrays.asList(new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("idfcxsspuunnoxyh") + .withReplicaResourceId("g") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("rihpfhoq") + .withEndpointUrl("a") + .withEndpointAuthenticationMode(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS) + .withCertificateName("omdjvlpjxxkzbrm") + .withEndpointConnectLogin("eivsiykzkdnc") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSessionTimeout(1449086974) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.NO) + .withBackupPriority(1838892910) + .withReadOnlyRoutingUrl("wuxrkjpvdwxfzwi") + .withReadWriteRoutingUrl("wzjbh") + .withSeedingMode(SeedingMode.AUTOMATIC)) + .withState(new AvailabilityGroupState())))) + .withDatabases(new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("zulwmmrqzzrrj"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("lgzurig"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("kjlmx"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("qyikvy")))); + model = BinaryData.fromObject(model).toObject(SqlServerAvailabilityGroupResourceProperties.class); + Assertions.assertEquals(1025144220, model.info().failureConditionLevel()); + Assertions.assertEquals(1940459602, model.info().healthCheckTimeout()); + Assertions.assertTrue(model.info().basicFeatures()); + Assertions.assertFalse(model.info().dtcSupport()); + Assertions.assertFalse(model.info().dbFailover()); + Assertions.assertFalse(model.info().isDistributed()); + Assertions.assertEquals(1969491549, model.info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(model.info().isContained()); + Assertions.assertEquals("gfnmntfpmvmemfnc", model.info().listener().dnsName()); + Assertions.assertEquals("vbalxlllc", model.info().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("odbzevwrdnhf", model.info().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("vsjcswsmystuluqy", model.info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1885440426, model.info().listener().port()); + Assertions.assertEquals("idfcxsspuunnoxyh", model.replicas().value().get(0).replicaName()); + Assertions.assertEquals("g", model.replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("rihpfhoq", model.replicas().value().get(0).configure().endpointName()); + Assertions.assertEquals("a", model.replicas().value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.replicas().value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("omdjvlpjxxkzbrm", model.replicas().value().get(0).configure().certificateName()); + Assertions.assertEquals("eivsiykzkdnc", model.replicas().value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.replicas().value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.AUTOMATIC, + model.replicas().value().get(0).configure().failoverMode()); + Assertions.assertEquals(1449086974, model.replicas().value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, + model.replicas().value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.NO, + model.replicas().value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(1838892910, model.replicas().value().get(0).configure().backupPriority()); + Assertions.assertEquals("wuxrkjpvdwxfzwi", model.replicas().value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("wzjbh", model.replicas().value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, model.replicas().value().get(0).configure().seedingMode()); + Assertions.assertEquals("zulwmmrqzzrrj", model.databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupUpdateTests.java new file mode 100644 index 000000000000..18c7cc2246ec --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupUpdateTests.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupUpdate; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerAvailabilityGroupUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerAvailabilityGroupUpdate model = BinaryData.fromString( + "{\"tags\":{\"pfpubcpzgpx\":\"uqdflvoni\"},\"properties\":{\"availabilityGroupId\":\"hjknidibg\",\"serverName\":\"xgpnr\",\"instanceName\":\"ov\",\"vmId\":\"pikqmh\",\"collectionTimestamp\":\"2021-07-13T05:51:22Z\",\"info\":{\"failureConditionLevel\":1733167142,\"healthCheckTimeout\":1551621761,\"automatedBackupPreferenceDescription\":\"uporqzdfu\",\"version\":1158054878,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":true,\"isDistributed\":false,\"clusterTypeDescription\":\"xqpswok\",\"requiredSynchronizedSecondariesToCommit\":1070878319,\"isContained\":false,\"primaryReplica\":\"gdhbe\",\"primaryRecoveryHealthDescription\":\"qkzszuwiwtglxxh\",\"secondaryRecoveryHealthDescription\":\"fpgpicrmnzhrgm\",\"synchronizationHealthDescription\":\"j\",\"replicationPartnerType\":\"AzureSQLVM\",\"listener\":{\"dnsName\":\"cbfrm\",\"ipV4AddressesAndMasks\":[{\"ipAddress\":\"hsqqgvriibakcl\",\"mask\":\"jfrnxousxauzlwv\"}],\"ipV6Addresses\":[\"wohqfzizvu\",\"mmkjsvthnwpztek\",\"vmribiat\",\"gplucfotangcfhny\"],\"port\":1077682035}},\"replicas\":{\"value\":[{\"replicaId\":\"vxwlmzqwmvtxnj\",\"replicaName\":\"mcuqudtcvc\",\"replicaResourceId\":\"ynpdkvgfab\",\"configure\":{\"endpointName\":\"jibuzphdug\",\"endpointUrl\":\"iknp\",\"endpointAuthenticationMode\":\"Certificate_Windows_Kerberos\",\"certificateName\":\"jiuqhibtozi\",\"endpointConnectLogin\":\"wjedmurrxxgew\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"qylkmqpzoyhlf\",\"failoverMode\":\"MANUAL\",\"failoverModeDescription\":\"gcl\",\"sessionTimeout\":325536454,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"injipnwjf\",\"secondaryAllowConnections\":\"NO\",\"secondaryRoleAllowConnectionsDescription\":\"afcba\",\"replicaCreateDate\":\"2021-08-29T21:34:19Z\",\"replicaModifyDate\":\"2021-05-18T22:00:53Z\",\"backupPriority\":746800344,\"readOnlyRoutingUrl\":\"iyjwpfilkmkkho\",\"readWriteRoutingUrl\":\"dndviauogp\",\"seedingMode\":\"AUTOMATIC\",\"seedingModeDescription\":\"tvt\"},\"state\":{\"availabilityGroupReplicaRole\":\"yefchnm\",\"operationalStateDescription\":\"hmnxhkxjqi\",\"recoveryHealthDescription\":\"rweooxffifhx\",\"synchronizationHealthDescription\":\"snewmozqvbub\",\"connectedStateDescription\":\"amhsycxhxzgazt\",\"lastConnectErrorDescription\":\"boi\",\"lastConnectErrorTimestamp\":\"2020-12-24T21:08:23Z\"}},{\"replicaId\":\"qhppubowsepdfgk\",\"replicaName\":\"dherngbtcj\",\"replicaResourceId\":\"hokq\",\"configure\":{\"endpointName\":\"kauxof\",\"endpointUrl\":\"fphwpnu\",\"endpointAuthenticationMode\":\"Windows_NTLM\",\"certificateName\":\"wzejywhslw\",\"endpointConnectLogin\":\"jpllndnpdwrpq\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"ug\",\"failoverMode\":\"AUTOMATIC\",\"failoverModeDescription\":\"hyet\",\"sessionTimeout\":1426304970,\"primaryAllowConnections\":\"ALL\",\"primaryRoleAllowConnectionsDescription\":\"octfjgtixrjvzuyt\",\"secondaryAllowConnections\":\"ALL\",\"secondaryRoleAllowConnectionsDescription\":\"muowolbauiro\",\"replicaCreateDate\":\"2021-07-21T06:19:54Z\",\"replicaModifyDate\":\"2021-11-07T05:08:05Z\",\"backupPriority\":1732176470,\"readOnlyRoutingUrl\":\"wpng\",\"readWriteRoutingUrl\":\"innixjawrtmjfj\",\"seedingMode\":\"MANUAL\",\"seedingModeDescription\":\"xlzhcoxovnekh\"},\"state\":{\"availabilityGroupReplicaRole\":\"usfnr\",\"operationalStateDescription\":\"jxtxrdc\",\"recoveryHealthDescription\":\"jvidttge\",\"synchronizationHealthDescription\":\"slvyjtcvuwkasi\",\"connectedStateDescription\":\"esfuught\",\"lastConnectErrorDescription\":\"fecjxeygtuhx\",\"lastConnectErrorTimestamp\":\"2021-01-12T18:06:14Z\"}},{\"replicaId\":\"uewmrswnjlxuzrhw\",\"replicaName\":\"sxjb\",\"replicaResourceId\":\"ehgpdohzjqatu\",\"configure\":{\"endpointName\":\"gebx\",\"endpointUrl\":\"nwfepbnwg\",\"endpointAuthenticationMode\":\"Windows_Negotiate\",\"certificateName\":\"gcgbjb\",\"endpointConnectLogin\":\"lfgtdysnaquflqbc\",\"availabilityMode\":\"ASYNCHRONOUS_COMMIT\",\"availabilityModeDescription\":\"mzjr\",\"failoverMode\":\"NONE\",\"failoverModeDescription\":\"zeqyjleziun\",\"sessionTimeout\":822376850,\"primaryAllowConnections\":\"READ_WRITE\",\"primaryRoleAllowConnectionsDescription\":\"ntkwcegy\",\"secondaryAllowConnections\":\"READ_ONLY\",\"secondaryRoleAllowConnectionsDescription\":\"nseqacjjvp\",\"replicaCreateDate\":\"2021-07-24T00:11:41Z\",\"replicaModifyDate\":\"2021-02-28T23:05:32Z\",\"backupPriority\":1726811272,\"readOnlyRoutingUrl\":\"agmdit\",\"readWriteRoutingUrl\":\"eiookjbsah\",\"seedingMode\":\"AUTOMATIC\",\"seedingModeDescription\":\"pdelqa\"},\"state\":{\"availabilityGroupReplicaRole\":\"m\",\"operationalStateDescription\":\"oebn\",\"recoveryHealthDescription\":\"o\",\"synchronizationHealthDescription\":\"cjkgdirazftxej\",\"connectedStateDescription\":\"bmdujtmvcopexc\",\"lastConnectErrorDescription\":\"urbuhhlkyqltq\",\"lastConnectErrorTimestamp\":\"2020-12-29T06:02:05Z\"}}],\"nextLink\":\"tuwkffdj\"},\"databases\":{\"value\":[{\"databaseName\":\"idfv\",\"replicaName\":\"g\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"jtkbusqogsfika\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"sharujtj\",\"databaseStateDescription\":\"xfz\",\"isSuspended\":false,\"suspendReasonDescription\":\"tvwkpqhjpenu\"},{\"databaseName\":\"bqeqqekewvnqvcd\",\"replicaName\":\"uaucmf\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"xpunjqi\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"vitac\",\"databaseStateDescription\":\"mfcsserx\",\"isSuspended\":false,\"suspendReasonDescription\":\"oxhlw\"},{\"databaseName\":\"sjgqrsxyp\",\"replicaName\":\"uuybnchrsz\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"lyetndnbfqygg\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"nlgmtrwahzjmu\",\"databaseStateDescription\":\"tb\",\"isSuspended\":true,\"suspendReasonDescription\":\"rohkpigqfusu\"}],\"nextLink\":\"zmkw\"},\"provisioningState\":\"snoxaxmqeqa\"}}") + .toObject(SqlServerAvailabilityGroupUpdate.class); + Assertions.assertEquals("uqdflvoni", model.tags().get("pfpubcpzgpx")); + Assertions.assertEquals(1733167142, model.properties().info().failureConditionLevel()); + Assertions.assertEquals(1551621761, model.properties().info().healthCheckTimeout()); + Assertions.assertFalse(model.properties().info().basicFeatures()); + Assertions.assertTrue(model.properties().info().dtcSupport()); + Assertions.assertTrue(model.properties().info().dbFailover()); + Assertions.assertFalse(model.properties().info().isDistributed()); + Assertions.assertEquals(1070878319, model.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(model.properties().info().isContained()); + Assertions.assertEquals("cbfrm", model.properties().info().listener().dnsName()); + Assertions.assertEquals("hsqqgvriibakcl", + model.properties().info().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("jfrnxousxauzlwv", + model.properties().info().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("wohqfzizvu", model.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1077682035, model.properties().info().listener().port()); + Assertions.assertEquals("mcuqudtcvc", model.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("ynpdkvgfab", model.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("jibuzphdug", model.properties().replicas().value().get(0).configure().endpointName()); + Assertions.assertEquals("iknp", model.properties().replicas().value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.properties().replicas().value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("jiuqhibtozi", + model.properties().replicas().value().get(0).configure().certificateName()); + Assertions.assertEquals("wjedmurrxxgew", + model.properties().replicas().value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.properties().replicas().value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.properties().replicas().value().get(0).configure().failoverMode()); + Assertions.assertEquals(325536454, model.properties().replicas().value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, + model.properties().replicas().value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.NO, + model.properties().replicas().value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(746800344, model.properties().replicas().value().get(0).configure().backupPriority()); + Assertions.assertEquals("iyjwpfilkmkkho", + model.properties().replicas().value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("dndviauogp", + model.properties().replicas().value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, + model.properties().replicas().value().get(0).configure().seedingMode()); + Assertions.assertEquals("idfv", model.properties().databases().value().get(0).databaseName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerAvailabilityGroupUpdate model + = new SqlServerAvailabilityGroupUpdate().withTags(mapOf("pfpubcpzgpx", "uqdflvoni")) + .withProperties( + new SqlServerAvailabilityGroupResourceProperties() + .withInfo( + new AvailabilityGroupInfo().withFailureConditionLevel(1733167142) + .withHealthCheckTimeout(1551621761) + .withBasicFeatures(false) + .withDtcSupport(true) + .withDbFailover(true) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(1070878319) + .withIsContained(false) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("cbfrm") + .withIpV4AddressesAndMasks( + Arrays.asList(new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() + .withIpAddress("hsqqgvriibakcl") + .withMask("jfrnxousxauzlwv"))) + .withIpV6Addresses( + Arrays.asList("wohqfzizvu", "mmkjsvthnwpztek", "vmribiat", "gplucfotangcfhny")) + .withPort(1077682035))) + .withReplicas( + new SqlServerAvailabilityGroupResourcePropertiesReplicas() + .withValue( + Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties() + .withReplicaName("mcuqudtcvc") + .withReplicaResourceId("ynpdkvgfab") + .withConfigure(new AvailabilityGroupConfigure() + .withEndpointName("jibuzphdug") + .withEndpointUrl("iknp") + .withEndpointAuthenticationMode( + ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS) + .withCertificateName("jiuqhibtozi") + .withEndpointConnectLogin("wjedmurrxxgew") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSessionTimeout(325536454) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.NO) + .withBackupPriority(746800344) + .withReadOnlyRoutingUrl("iyjwpfilkmkkho") + .withReadWriteRoutingUrl("dndviauogp") + .withSeedingMode(SeedingMode.AUTOMATIC)) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties() + .withReplicaName("dherngbtcj") + .withReplicaResourceId("hokq") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("kauxof") + .withEndpointUrl("fphwpnu") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NTLM) + .withCertificateName("wzejywhslw") + .withEndpointConnectLogin("jpllndnpdwrpq") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSessionTimeout(1426304970) + .withPrimaryAllowConnections(PrimaryAllowConnections.ALL) + .withSecondaryAllowConnections(SecondaryAllowConnections.ALL) + .withBackupPriority(1732176470) + .withReadOnlyRoutingUrl("wpng") + .withReadWriteRoutingUrl("innixjawrtmjfj") + .withSeedingMode(SeedingMode.MANUAL)) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("sxjb") + .withReplicaResourceId("ehgpdohzjqatu") + .withConfigure(new AvailabilityGroupConfigure().withEndpointName("gebx") + .withEndpointUrl("nwfepbnwg") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NEGOTIATE) + .withCertificateName("gcgbjb") + .withEndpointConnectLogin("lfgtdysnaquflqbc") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSessionTimeout(822376850) + .withPrimaryAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withSecondaryAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withBackupPriority(1726811272) + .withReadOnlyRoutingUrl("agmdit") + .withReadWriteRoutingUrl("eiookjbsah") + .withSeedingMode(SeedingMode.AUTOMATIC)) + .withState(new AvailabilityGroupState())))) + .withDatabases( + new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue(Arrays.asList( + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("idfv"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("bqeqqekewvnqvcd"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("sjgqrsxyp"))))); + model = BinaryData.fromObject(model).toObject(SqlServerAvailabilityGroupUpdate.class); + Assertions.assertEquals("uqdflvoni", model.tags().get("pfpubcpzgpx")); + Assertions.assertEquals(1733167142, model.properties().info().failureConditionLevel()); + Assertions.assertEquals(1551621761, model.properties().info().healthCheckTimeout()); + Assertions.assertFalse(model.properties().info().basicFeatures()); + Assertions.assertTrue(model.properties().info().dtcSupport()); + Assertions.assertTrue(model.properties().info().dbFailover()); + Assertions.assertFalse(model.properties().info().isDistributed()); + Assertions.assertEquals(1070878319, model.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(model.properties().info().isContained()); + Assertions.assertEquals("cbfrm", model.properties().info().listener().dnsName()); + Assertions.assertEquals("hsqqgvriibakcl", + model.properties().info().listener().ipV4AddressesAndMasks().get(0).ipAddress()); + Assertions.assertEquals("jfrnxousxauzlwv", + model.properties().info().listener().ipV4AddressesAndMasks().get(0).mask()); + Assertions.assertEquals("wohqfzizvu", model.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1077682035, model.properties().info().listener().port()); + Assertions.assertEquals("mcuqudtcvc", model.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("ynpdkvgfab", model.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("jibuzphdug", model.properties().replicas().value().get(0).configure().endpointName()); + Assertions.assertEquals("iknp", model.properties().replicas().value().get(0).configure().endpointUrl()); + Assertions.assertEquals(ConnectionAuth.CERTIFICATE_WINDOWS_KERBEROS, + model.properties().replicas().value().get(0).configure().endpointAuthenticationMode()); + Assertions.assertEquals("jiuqhibtozi", + model.properties().replicas().value().get(0).configure().certificateName()); + Assertions.assertEquals("wjedmurrxxgew", + model.properties().replicas().value().get(0).configure().endpointConnectLogin()); + Assertions.assertEquals(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT, + model.properties().replicas().value().get(0).configure().availabilityMode()); + Assertions.assertEquals(ArcSqlServerFailoverMode.MANUAL, + model.properties().replicas().value().get(0).configure().failoverMode()); + Assertions.assertEquals(325536454, model.properties().replicas().value().get(0).configure().sessionTimeout()); + Assertions.assertEquals(PrimaryAllowConnections.READ_WRITE, + model.properties().replicas().value().get(0).configure().primaryAllowConnections()); + Assertions.assertEquals(SecondaryAllowConnections.NO, + model.properties().replicas().value().get(0).configure().secondaryAllowConnections()); + Assertions.assertEquals(746800344, model.properties().replicas().value().get(0).configure().backupPriority()); + Assertions.assertEquals("iyjwpfilkmkkho", + model.properties().replicas().value().get(0).configure().readOnlyRoutingUrl()); + Assertions.assertEquals("dndviauogp", + model.properties().replicas().value().get(0).configure().readWriteRoutingUrl()); + Assertions.assertEquals(SeedingMode.AUTOMATIC, + model.properties().replicas().value().get(0).configure().seedingMode()); + Assertions.assertEquals("idfv", model.properties().databases().value().get(0).databaseName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesWithResponseMockTests.java new file mode 100644 index 000000000000..7c3bdd76c6ee --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsAddDatabasesWithResponseMockTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsAddDatabasesWithResponseMockTests { + @Test + public void testAddDatabasesWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"uwazcgwdfriwg\",\"serverName\":\"jpozoksc\",\"instanceName\":\"llixdgbyfgw\",\"vmId\":\"qkjvxprwpxsoohu\",\"collectionTimestamp\":\"2021-08-22T02:15:27Z\",\"info\":{\"failureConditionLevel\":586738136,\"healthCheckTimeout\":1569238498,\"automatedBackupPreferenceDescription\":\"zuu\",\"version\":974954201,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":false,\"isDistributed\":true,\"clusterTypeDescription\":\"ubsrtmdylperpilt\",\"requiredSynchronizedSecondariesToCommit\":1525228635,\"isContained\":true,\"primaryReplica\":\"fcm\",\"primaryRecoveryHealthDescription\":\"fbodetresrgvts\",\"secondaryRecoveryHealthDescription\":\"vftwaiv\",\"synchronizationHealthDescription\":\"qkevzgj\",\"replicationPartnerType\":\"SQLServer\",\"listener\":{\"dnsName\":\"xmpdxxzetww\",\"ipV4AddressesAndMasks\":[{}],\"ipV6Addresses\":[\"nxlkfhglhrfoxqwe\",\"rsnhpcs\",\"lqxov\"],\"port\":720846419}},\"replicas\":{\"value\":[{\"replicaId\":\"klvzrl\",\"replicaName\":\"l\",\"replicaResourceId\":\"metjs\",\"configure\":{},\"state\":{}},{\"replicaId\":\"fqbqnasd\",\"replicaName\":\"enz\",\"replicaResourceId\":\"euscplhyv\",\"configure\":{},\"state\":{}},{\"replicaId\":\"yzkxitds\",\"replicaName\":\"zsvko\",\"replicaResourceId\":\"upjo\",\"configure\":{},\"state\":{}}],\"nextLink\":\"sayebra\"},\"databases\":{\"value\":[{\"databaseName\":\"zbtz\",\"replicaName\":\"kykipfsdyepfnoc\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"fp\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"zwyqejga\",\"databaseStateDescription\":\"kctgkp\",\"isSuspended\":true,\"suspendReasonDescription\":\"zkcyzmffngdyfci\"},{\"databaseName\":\"hlcqvhoe\",\"replicaName\":\"oiutgwrmkahpq\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"a\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"cogmi\",\"databaseStateDescription\":\"mliqmvlb\",\"isSuspended\":false,\"suspendReasonDescription\":\"aqgrv\"},{\"databaseName\":\"omxp\",\"replicaName\":\"dtsdfjy\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"iqbuou\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"zgleofjsbg\",\"databaseStateDescription\":\"wzvdajfwnncfm\",\"isSuspended\":true,\"suspendReasonDescription\":\"gjj\"},{\"databaseName\":\"h\",\"replicaName\":\"lwixvtbou\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"opgjttba\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"ap\",\"databaseStateDescription\":\"n\",\"isSuspended\":false,\"suspendReasonDescription\":\"qb\"}],\"nextLink\":\"xvvlwyn\"},\"provisioningState\":\"bfqvzfjmspu\"},\"location\":\"feuzjljmphfkye\",\"tags\":{\"mi\":\"gj\",\"hanzbuiad\":\"uydoccnx\"},\"id\":\"batecaat\",\"name\":\"dohzniucbdaombwi\",\"type\":\"njdllwktlepowavv\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .addDatabasesWithResponse("tftedz", "ubjtvgjsxmtyjjv", "vdpwwobtdphti", + new Databases().withValues(Arrays.asList("fofwan", "hks")), com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("feuzjljmphfkye", response.location()); + Assertions.assertEquals("gj", response.tags().get("mi")); + Assertions.assertEquals(586738136, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1569238498, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertTrue(response.properties().info().isDistributed()); + Assertions.assertEquals(1525228635, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("xmpdxxzetww", response.properties().info().listener().dnsName()); + Assertions.assertEquals("nxlkfhglhrfoxqwe", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(720846419, response.properties().info().listener().port()); + Assertions.assertEquals("l", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("metjs", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("zbtz", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupMockTests.java new file mode 100644 index 000000000000..8d6cb827ec55 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateAvailabilityGroupMockTests.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsCreateAvailabilityGroupMockTests { + @Test + public void testCreateAvailabilityGroup() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"kyzbfvxovqkxiux\",\"serverName\":\"gvqrnhyhlwcj\",\"instanceName\":\"ggjh\",\"vmId\":\"bxrqrkijp\",\"collectionTimestamp\":\"2021-02-11T11:24:24Z\",\"info\":{\"failureConditionLevel\":265572800,\"healthCheckTimeout\":718585214,\"automatedBackupPreferenceDescription\":\"ztv\",\"version\":818856345,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":false,\"isDistributed\":false,\"clusterTypeDescription\":\"wwa\",\"requiredSynchronizedSecondariesToCommit\":1358634456,\"isContained\":false,\"primaryReplica\":\"ioulndhzyoe\",\"primaryRecoveryHealthDescription\":\"ht\",\"secondaryRecoveryHealthDescription\":\"lhsvidmytzlnglxp\",\"synchronizationHealthDescription\":\"vyoanfbcswqagywv\",\"replicationPartnerType\":\"AzureSQLVM\",\"listener\":{\"dnsName\":\"jrktpgaeukya\",\"ipV4AddressesAndMasks\":[{},{},{}],\"ipV6Addresses\":[\"w\",\"qnucs\",\"lhsidsjtdl\"],\"port\":979080731}},\"replicas\":{\"value\":[{\"replicaId\":\"azlsvbzfcpuo\",\"replicaName\":\"dwjcciklhs\",\"replicaResourceId\":\"krdre\",\"configure\":{},\"state\":{}},{\"replicaId\":\"riyehqbeivdlhy\",\"replicaName\":\"bdbfgrlp\",\"replicaResourceId\":\"ytjlkesmmpath\",\"configure\":{},\"state\":{}}],\"nextLink\":\"h\"},\"databases\":{\"value\":[{\"databaseName\":\"iwllbvgwzsffted\",\"replicaName\":\"snkt\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"aqo\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"ebauzlqbtx\",\"databaseStateDescription\":\"pfhnjzudrt\",\"isSuspended\":false,\"suspendReasonDescription\":\"meboywhczzq\"},{\"databaseName\":\"mngqbe\",\"replicaName\":\"gis\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"d\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"hlr\",\"databaseStateDescription\":\"wctofldseacdhz\",\"isSuspended\":true,\"suspendReasonDescription\":\"rfgdrwj\"},{\"databaseName\":\"ewhfjsrwqrxetf\",\"replicaName\":\"wvrrmdqn\",\"isLocal\":false,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"thvmaxgnuyeamcmh\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"ecehokw\",\"databaseStateDescription\":\"qtwloes\",\"isSuspended\":true,\"suspendReasonDescription\":\"vrbnyrukoil\"}],\"nextLink\":\"iduw\"},\"provisioningState\":\"Succeeded\"},\"location\":\"jlhwyxpzruzyt\",\"tags\":{\"lvulnxdmnitmujdt\":\"kwhbgxve\",\"ymffhmjpddnyx\":\"mcl\",\"qrbrpvnmdyfoeboj\":\"zuvrzmzqmz\",\"laohoqkp\":\"jpp\"},\"id\":\"t\",\"name\":\"qjilaywkdcwmqsyr\",\"type\":\"lmhxdqaolfylnk\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .createAvailabilityGroup("zdajlskzptjxu", "weucyrth", + new AvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("lehmcgcjeinueho") + .withReplicas(Arrays.asList( + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("fejvqn") + .withEndpointName("mbqdabzfivfo") + .withEndpointUrl("ysthhza") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_KERBEROS) + .withCertificateName("yyrlhgenu") + .withEndpointConnectLogin("jgvkvebaqszllr") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.MANUAL) + .withBackupPriority(897489101) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withSecondaryRoleReadOnlyRoutingUrl("pimcqrhn") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList( + Arrays.asList("klogx", "vtza", "hzvqnsqktcmbjwz", "oslpky")) + .withSessionTimeout(951849874), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("wkzpga") + .withEndpointName("qjcemqbmf") + .withEndpointUrl("qarwzxuqreblu") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NTLM_CERTIFICATE) + .withCertificateName("wxs") + .withEndpointConnectLogin("td") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.MANUAL) + .withBackupPriority(1060431401) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withSecondaryRoleReadOnlyRoutingUrl("budbt") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withPrimaryRoleReadOnlyRoutingList(Arrays.asList("avlyttaaknwf", "ke")) + .withSessionTimeout(1106945461), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("p") + .withEndpointName("jdigatole") + .withEndpointUrl("cbctnanqimwbzx") + .withEndpointAuthenticationMode(ConnectionAuth.CERTIFICATE_WINDOWS_NTLM) + .withCertificateName("dpkawnsnl") + .withEndpointConnectLogin("mouxwksqmudmfco") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.MANUAL) + .withBackupPriority(754348309) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withSecondaryRoleReadOnlyRoutingUrl("rk") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList( + Arrays.asList("btqqvyfs", "yrfwbivq", "ogfuyzwvbhlim", "yqe")) + .withSessionTimeout(713972670), + new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("dlikcdrdaasa") + .withEndpointName("obsmf") + .withEndpointUrl("iyjvz") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_NEGOTIATE_CERTIFICATE) + .withCertificateName("r") + .withEndpointConnectLogin("wnvz") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(1660222132) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.READ_ONLY) + .withSecondaryRoleReadOnlyRoutingUrl("bjqqaxuyvymcn") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.READ_WRITE) + .withPrimaryRoleReadOnlyRoutingList(Arrays.asList("abhjx", "xqweu", "pmpvks", "itnsqxtltc")) + .withSessionTimeout(2077569332))) + .withDatabases(Arrays.asList("qgfhyrf", "akkldgrcwfcmfcn", "jajqmatxjt")) + .withAutomatedBackupPreference(AutomatedBackupPreference.PRIMARY) + .withFailureConditionLevel(FailureConditionLevel.THREE) + .withHealthCheckTimeout(1395640980) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.PERDB) + .withRequiredSynchronizedSecondariesToCommit(685427163) + .withClusterType(ClusterType.NONE) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("qagynoipr") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("lin") + .withMask("yqxzxaqzibmqim"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("mqruqguhfupe") + .withMask("svvoqsbpkflanfk"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("syaowuzowp") + .withMask("hdkcprgu"))) + .withIpV6Addresses(Arrays.asList("ztiochluti", "mqrud", "izcbfzmcrunfhiuc", "mfbcpaqktkrum")) + .withPort(493159617)), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("jlhwyxpzruzyt", response.location()); + Assertions.assertEquals("kwhbgxve", response.tags().get("lvulnxdmnitmujdt")); + Assertions.assertEquals(265572800, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(718585214, response.properties().info().healthCheckTimeout()); + Assertions.assertTrue(response.properties().info().basicFeatures()); + Assertions.assertFalse(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertFalse(response.properties().info().isDistributed()); + Assertions.assertEquals(1358634456, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(response.properties().info().isContained()); + Assertions.assertEquals("jrktpgaeukya", response.properties().info().listener().dnsName()); + Assertions.assertEquals("w", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(979080731, response.properties().info().listener().port()); + Assertions.assertEquals("dwjcciklhs", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("krdre", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("iwllbvgwzsffted", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupMockTests.java new file mode 100644 index 000000000000..d1e5a8acdc30 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupMockTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsCreateDistributedAvailabilityGroupMockTests { + @Test + public void testCreateDistributedAvailabilityGroup() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"daqotwfh\",\"serverName\":\"xwgsa\",\"instanceName\":\"c\",\"vmId\":\"owzafczu\",\"collectionTimestamp\":\"2021-04-05T04:59:08Z\",\"info\":{\"failureConditionLevel\":713994092,\"healthCheckTimeout\":1435657478,\"automatedBackupPreferenceDescription\":\"efy\",\"version\":1365265571,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":true,\"isDistributed\":false,\"clusterTypeDescription\":\"zaj\",\"requiredSynchronizedSecondariesToCommit\":49772218,\"isContained\":true,\"primaryReplica\":\"ju\",\"primaryRecoveryHealthDescription\":\"xbxq\",\"secondaryRecoveryHealthDescription\":\"vuaytuad\",\"synchronizationHealthDescription\":\"xeqbwp\",\"replicationPartnerType\":\"Unknown\",\"listener\":{\"dnsName\":\"ksarcdrnxsluvl\",\"ipV4AddressesAndMasks\":[{},{},{},{}],\"ipV6Addresses\":[\"t\",\"kpbqhvfdqqjw\"],\"port\":1684052822}},\"replicas\":{\"value\":[{\"replicaId\":\"nojisgglmvok\",\"replicaName\":\"uztjct\",\"replicaResourceId\":\"pvbkaehxsmzyg\",\"configure\":{},\"state\":{}}],\"nextLink\":\"kwseivmakxhyso\"},\"databases\":{\"value\":[{\"databaseName\":\"lkbectvtfjmskd\",\"replicaName\":\"maiubavlzwp\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"kzaz\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"e\",\"databaseStateDescription\":\"jqafkmkro\",\"isSuspended\":false,\"suspendReasonDescription\":\"hqet\"}],\"nextLink\":\"qrtvaoznqni\"},\"provisioningState\":\"Succeeded\"},\"location\":\"fpjstlzmb\",\"tags\":{\"fsyrledjc\":\"jdeolctae\",\"xzvsgeafgf\":\"stbvtqig\",\"kkwa\":\"sehxlzsxezp\",\"yfjlpzeqto\":\"es\"},\"id\":\"rpl\",\"name\":\"xlaj\",\"type\":\"llpquevhamfo\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .createDistributedAvailabilityGroup("bjpjvlyw", "tmfwobbjwhl", + new DistributedAvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("j") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("zocrdzgczeu") + .withListenerUrl("g") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("ekoifuvnyttzgi"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("rihl") + .withListenerUrl("gbehlqtxnr") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.MANUAL) + .withSeedingMode(SeedingMode.MANUAL) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("gfjo"))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fpjstlzmb", response.location()); + Assertions.assertEquals("jdeolctae", response.tags().get("fsyrledjc")); + Assertions.assertEquals(713994092, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1435657478, response.properties().info().healthCheckTimeout()); + Assertions.assertTrue(response.properties().info().basicFeatures()); + Assertions.assertFalse(response.properties().info().dtcSupport()); + Assertions.assertTrue(response.properties().info().dbFailover()); + Assertions.assertFalse(response.properties().info().isDistributed()); + Assertions.assertEquals(49772218, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("ksarcdrnxsluvl", response.properties().info().listener().dnsName()); + Assertions.assertEquals("t", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1684052822, response.properties().info().listener().port()); + Assertions.assertEquals("uztjct", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("pvbkaehxsmzyg", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("lkbectvtfjmskd", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateManagedInstanceLinkMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateManagedInstanceLinkMockTests.java new file mode 100644 index 000000000000..63fafcdb7ffc --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateManagedInstanceLinkMockTests.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityMode; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerFailoverMode; +import com.azure.resourcemanager.azurearcdata.models.AutomatedBackupPreference; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupCreateUpdateReplicaConfiguration; +import com.azure.resourcemanager.azurearcdata.models.ClusterType; +import com.azure.resourcemanager.azurearcdata.models.ConnectionAuth; +import com.azure.resourcemanager.azurearcdata.models.DbFailover; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DistributedAvailabilityGroupCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.DtcSupport; +import com.azure.resourcemanager.azurearcdata.models.FailureConditionLevel; +import com.azure.resourcemanager.azurearcdata.models.ManagedInstanceLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.MiLinkCreateUpdateConfiguration; +import com.azure.resourcemanager.azurearcdata.models.PrimaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SecondaryAllowConnections; +import com.azure.resourcemanager.azurearcdata.models.SeedingMode; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsCreateManagedInstanceLinkMockTests { + @Test + public void testCreateManagedInstanceLink() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"jglzrsubklrxhjnl\",\"serverName\":\"etjdvqydieqqkwa\",\"instanceName\":\"wdxvqzxoebwg\",\"vmId\":\"bibanbau\",\"collectionTimestamp\":\"2021-11-14T00:36:12Z\",\"info\":{\"failureConditionLevel\":611504027,\"healthCheckTimeout\":1907191416,\"automatedBackupPreferenceDescription\":\"ozkxbzrpejplss\",\"version\":848316015,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":false,\"isDistributed\":true,\"clusterTypeDescription\":\"nrswgkpjhboyik\",\"requiredSynchronizedSecondariesToCommit\":559590386,\"isContained\":true,\"primaryReplica\":\"slgwlokhueoij\",\"primaryRecoveryHealthDescription\":\"cqypz\",\"secondaryRecoveryHealthDescription\":\"ufgsyfejyvdw\",\"synchronizationHealthDescription\":\"xptpqaya\",\"replicationPartnerType\":\"Unknown\",\"listener\":{\"dnsName\":\"gybm\",\"ipV4AddressesAndMasks\":[{},{}],\"ipV6Addresses\":[\"cuul\",\"ojkpoyh\",\"wwdjuxdbdl\",\"zgdyrcvuqbs\"],\"port\":385705995}},\"replicas\":{\"value\":[{\"replicaId\":\"jnqogdxwbsfpyx\",\"replicaName\":\"jlf\",\"replicaResourceId\":\"cominxojjluxx\",\"configure\":{},\"state\":{}}],\"nextLink\":\"zzdzzqjmuezayov\"},\"databases\":{\"value\":[{\"databaseName\":\"otokhtvwtaznk\",\"replicaName\":\"wwxwjyofgw\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"wl\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"ctsnldkpwol\",\"databaseStateDescription\":\"s\",\"isSuspended\":true,\"suspendReasonDescription\":\"teogfgfiijr\"},{\"databaseName\":\"wlefksxqceazfpxg\",\"replicaName\":\"qvzvlu\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"ssscyvai\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"acvfyeowps\",\"databaseStateDescription\":\"tjdhsoymhpvtyq\",\"isSuspended\":true,\"suspendReasonDescription\":\"hdpbo\"}],\"nextLink\":\"stkfvvdshxcdeds\"},\"provisioningState\":\"Succeeded\"},\"location\":\"fnslnlrxsmy\",\"tags\":{\"kurrdreyzjwh\":\"wntfmtbgwjdxwna\",\"jwzzqseuzu\":\"etw\"},\"id\":\"kykcyqhyqqzz\",\"name\":\"c\",\"type\":\"keys\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .createManagedInstanceLink("gwb", "mkekxpkzwaqxo", new ManagedInstanceLinkCreateUpdateConfiguration() + .withAvailabilityGroup( + new AvailabilityGroupCreateUpdateConfiguration().withAvailabilityGroupName("vchiqbpl") + .withReplicas(Arrays + .asList(new AvailabilityGroupCreateUpdateReplicaConfiguration().withServerInstance("uszte") + .withEndpointName("byjgmsfepx") + .withEndpointUrl("hpqadagrhrdicxdw") + .withEndpointAuthenticationMode(ConnectionAuth.WINDOWS_KERBEROS_CERTIFICATE) + .withCertificateName("wxwy") + .withEndpointConnectLogin("c") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.AUTOMATIC) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withBackupPriority(1522506889) + .withSecondaryRoleAllowConnections(SecondaryAllowConnections.NO) + .withSecondaryRoleReadOnlyRoutingUrl("eksbuhoduchvls") + .withPrimaryRoleAllowConnections(PrimaryAllowConnections.ALL) + .withPrimaryRoleReadOnlyRoutingList(Arrays.asList("bfdyjduss")) + .withSessionTimeout(1382840208))) + .withDatabases(Arrays.asList("kbhwlkaaggkrehbf", "n", "ybff")) + .withAutomatedBackupPreference(AutomatedBackupPreference.SECONDARY) + .withFailureConditionLevel(FailureConditionLevel.TWO) + .withHealthCheckTimeout(1266695300) + .withDbFailover(DbFailover.ON) + .withDtcSupport(DtcSupport.PERDB) + .withRequiredSynchronizedSecondariesToCommit(1889738772) + .withClusterType(ClusterType.NONE) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("usrexxf") + .withIpV4AddressesAndMasks(Arrays.asList( + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() + .withIpAddress("wudohzilfm") + .withMask("ikpsimsfeypof"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem().withIpAddress("mb") + .withMask("qgsdr"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() + .withIpAddress("ttjxophgerhsmvgo") + .withMask("wzm"), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem() + .withIpAddress("lrixysfnimsq") + .withMask("wwmhkruwae"))) + .withIpV6Addresses(Arrays.asList("mpmlqoin", "zduewihapfjii", "njdiqfliejhpcl")) + .withPort(1765036901))) + .withDistributedAvailabilityGroup(new DistributedAvailabilityGroupCreateUpdateConfiguration() + .withAvailabilityGroupName("sbw") + .withPrimaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("vbvzipbwxgo") + .withListenerUrl("x") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.SYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.AUTOMATIC) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("knpdgzigjsu"))) + .withSecondaryAvailabilityGroup( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupConfiguration() + .withAvailabilityGroup("hgsaodkwwn") + .withListenerUrl("foct") + .withAvailabilityMode(ArcSqlServerAvailabilityMode.ASYNCHRONOUS_COMMIT) + .withFailoverMode(ArcSqlServerFailoverMode.NONE) + .withSeedingMode(SeedingMode.MANUAL) + .withCertificateConfiguration( + new DistributedAvailabilityGroupCreateUpdateAvailabilityGroupCertificateConfiguration() + .withCertificateName("sxbgnvkervqchoa")))) + .withMiLinkConfiguration( + new MiLinkCreateUpdateConfiguration().withInstanceAvailabilityGroupName("sxqvzvspabdsrg")), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fnslnlrxsmy", response.location()); + Assertions.assertEquals("wntfmtbgwjdxwna", response.tags().get("kurrdreyzjwh")); + Assertions.assertEquals(611504027, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1907191416, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertTrue(response.properties().info().isDistributed()); + Assertions.assertEquals(559590386, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("gybm", response.properties().info().listener().dnsName()); + Assertions.assertEquals("cuul", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(385705995, response.properties().info().listener().port()); + Assertions.assertEquals("jlf", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("cominxojjluxx", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("otokhtvwtaznk", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateWithResponseMockTests.java new file mode 100644 index 000000000000..58bf10d98b03 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsCreateWithResponseMockTests.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupConfigure; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupInfo; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupState; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupDatabaseReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupReplicaResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlAvailabilityGroupStaticIPListenerProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesDatabases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResourcePropertiesReplicas; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"zyybzo\",\"serverName\":\"v\",\"instanceName\":\"ptvdxxheigm\",\"vmId\":\"lwzgh\",\"collectionTimestamp\":\"2021-02-09T14:14:43Z\",\"info\":{\"failureConditionLevel\":1662744876,\"healthCheckTimeout\":902978315,\"automatedBackupPreferenceDescription\":\"bwayb\",\"version\":210425357,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":false,\"isDistributed\":false,\"clusterTypeDescription\":\"apr\",\"requiredSynchronizedSecondariesToCommit\":2069393953,\"isContained\":true,\"primaryReplica\":\"nbsconx\",\"primaryRecoveryHealthDescription\":\"ipneychb\",\"secondaryRecoveryHealthDescription\":\"zqfsgnwdxzed\",\"synchronizationHealthDescription\":\"l\",\"replicationPartnerType\":\"SQLServer\",\"listener\":{\"dnsName\":\"xi\",\"ipV4AddressesAndMasks\":[{},{}],\"ipV6Addresses\":[\"yzavfrbypicdbkpd\",\"taq\",\"smqaz\",\"dgonjhxshthmgp\"],\"port\":1082014127}},\"replicas\":{\"value\":[{\"replicaId\":\"kbvcpxtzhigqqbti\",\"replicaName\":\"kjblornsihqh\",\"replicaResourceId\":\"smusuaawj\",\"configure\":{},\"state\":{}},{\"replicaId\":\"jnfczmnniixy\",\"replicaName\":\"qban\",\"replicaResourceId\":\"jtgirnb\",\"configure\":{},\"state\":{}},{\"replicaId\":\"ddorgmynltwmpft\",\"replicaName\":\"oeajogsy\",\"replicaResourceId\":\"etamfddrvlkpzwb\",\"configure\":{},\"state\":{}}],\"nextLink\":\"cc\"},\"databases\":{\"value\":[{\"databaseName\":\"muhkahm\",\"replicaName\":\"dbiucvkhhwmjpjbw\",\"isLocal\":false,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"rrihufoi\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"ybxvgn\",\"databaseStateDescription\":\"zpbgkzc\",\"isSuspended\":false,\"suspendReasonDescription\":\"uzvkunhdimjuk\"},{\"databaseName\":\"r\",\"replicaName\":\"a\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"ocf\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"gofmhxwrjlv\",\"databaseStateDescription\":\"lkv\",\"isSuspended\":true,\"suspendReasonDescription\":\"yjtkakvlb\"}],\"nextLink\":\"hjvpzaptu\"},\"provisioningState\":\"kaoizjixw\"},\"location\":\"cdiykkc\",\"tags\":{\"dmuqohhi\":\"ujvqynvavit\",\"ddrwjcljbrhlhpvz\":\"raxq\",\"inafhxrzfrm\":\"dbwen\"},\"id\":\"ztiucwviql\",\"name\":\"ukhk\",\"type\":\"cqx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .define("txop") + .withRegion("pzkgxfxfmyrqsd") + .withExistingSqlServerInstance("tjtdrhutfd", "a") + .withProperties(new SqlServerAvailabilityGroupResourceProperties() + .withInfo(new AvailabilityGroupInfo().withFailureConditionLevel(2145155757) + .withHealthCheckTimeout(20348867) + .withBasicFeatures(false) + .withDtcSupport(true) + .withDbFailover(false) + .withIsDistributed(false) + .withRequiredSynchronizedSecondariesToCommit(288459010) + .withIsContained(true) + .withListener(new SqlAvailabilityGroupStaticIPListenerProperties().withDnsName("yszzaczsinqb") + .withIpV4AddressesAndMasks( + Arrays.asList(new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem(), + new SqlAvailabilityGroupIpV4AddressesAndMasksPropertiesItem())) + .withIpV6Addresses(Arrays.asList("bozsyvr", "kjmyitrchwudlx")) + .withPort(821703101))) + .withReplicas(new SqlServerAvailabilityGroupResourcePropertiesReplicas().withValue(Arrays.asList( + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("rfgxkyd") + .withReplicaResourceId("yp") + .withConfigure(new AvailabilityGroupConfigure()) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("p") + .withReplicaResourceId("pewpyj") + .withConfigure(new AvailabilityGroupConfigure()) + .withState(new AvailabilityGroupState()), + new SqlAvailabilityGroupReplicaResourceProperties().withReplicaName("crzge") + .withReplicaResourceId("xbpiat") + .withConfigure(new AvailabilityGroupConfigure()) + .withState(new AvailabilityGroupState())))) + .withDatabases(new SqlServerAvailabilityGroupResourcePropertiesDatabases().withValue( + Arrays.asList(new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("dr"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties().withDatabaseName("o"), + new SqlAvailabilityGroupDatabaseReplicaResourceProperties() + .withDatabaseName("fmmainwhedxkpbq"))))) + .withTags(mapOf("diuwki", "kszanmhwgpte")) + .create(); + + Assertions.assertEquals("cdiykkc", response.location()); + Assertions.assertEquals("ujvqynvavit", response.tags().get("dmuqohhi")); + Assertions.assertEquals(1662744876, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(902978315, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertFalse(response.properties().info().isDistributed()); + Assertions.assertEquals(2069393953, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("xi", response.properties().info().listener().dnsName()); + Assertions.assertEquals("yzavfrbypicdbkpd", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1082014127, response.properties().info().listener().port()); + Assertions.assertEquals("kjblornsihqh", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("smusuaawj", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("muhkahm", response.properties().databases().value().get(0).databaseName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewWithResponseMockTests.java new file mode 100644 index 000000000000..17919dfb0a0c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsDetailViewWithResponseMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsDetailViewWithResponseMockTests { + @Test + public void testDetailViewWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"hlobvvjbhv\",\"serverName\":\"iqayflu\",\"instanceName\":\"uosnuud\",\"vmId\":\"lvhyibdrqrswhbu\",\"collectionTimestamp\":\"2021-05-08T21:22:19Z\",\"info\":{\"failureConditionLevel\":1077449031,\"healthCheckTimeout\":1916695552,\"automatedBackupPreferenceDescription\":\"oxztfwfqch\",\"version\":429009964,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":false,\"isDistributed\":true,\"clusterTypeDescription\":\"fyvrtpqpemhzcgk\",\"requiredSynchronizedSecondariesToCommit\":1325957084,\"isContained\":true,\"primaryReplica\":\"qyhwqwem\",\"primaryRecoveryHealthDescription\":\"qabckmzeoxin\",\"secondaryRecoveryHealthDescription\":\"re\",\"synchronizationHealthDescription\":\"twhlpuzjpce\",\"replicationPartnerType\":\"AzureSQLManagedInstance\",\"listener\":{\"dnsName\":\"ng\",\"ipV4AddressesAndMasks\":[{},{},{}],\"ipV6Addresses\":[\"xyxz\",\"bcip\",\"msexroqr\"],\"port\":116645342}},\"replicas\":{\"value\":[{\"replicaId\":\"onfeeqgp\",\"replicaName\":\"ietbgnix\",\"replicaResourceId\":\"wwzkyf\",\"configure\":{},\"state\":{}}],\"nextLink\":\"iwxeiicrmpep\"},\"databases\":{\"value\":[{\"databaseName\":\"xxij\",\"replicaName\":\"kwsdgkj\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"asekwefcvoinw\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"twyx\",\"databaseStateDescription\":\"cladvatdavuqmcb\",\"isSuspended\":false,\"suspendReasonDescription\":\"ob\"},{\"databaseName\":\"quvjez\",\"replicaName\":\"umvpsimioyoigl\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"nracli\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"pspkladydgnhautw\",\"databaseStateDescription\":\"exzgpmnmabedd\",\"isSuspended\":true,\"suspendReasonDescription\":\"gdfpfqfpcvst\"},{\"databaseName\":\"gq\",\"replicaName\":\"werfwx\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"jj\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"ifkwdvbtbrekqhs\",\"databaseStateDescription\":\"tfpwpqbyejuw\",\"isSuspended\":false,\"suspendReasonDescription\":\"qigmgh\"},{\"databaseName\":\"nztxlujkh\",\"replicaName\":\"cmrnkfmkhcq\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"jnqtqe\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"dvragpokddxejhh\",\"databaseStateDescription\":\"guavtptb\",\"isSuspended\":false,\"suspendReasonDescription\":\"qynspgbvoffb\"}],\"nextLink\":\"w\"},\"provisioningState\":\"xaexqokmyrljial\"},\"location\":\"nobrqlpb\",\"tags\":{\"hsqe\":\"rpzuyudivbx\",\"y\":\"eonqelwgdhuru\",\"ogatmoljiy\":\"za\",\"knsjulugd\":\"mpinmzvfkneerzzt\"},\"id\":\"bnhrxlelfjhkeiz\",\"name\":\"pihtdmiwjekpt\",\"type\":\"caydbjzcqymlcfnz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .detailViewWithResponse("aqgzekajclyzgs", "orbjg", "nzjotvmr", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("nobrqlpb", response.location()); + Assertions.assertEquals("rpzuyudivbx", response.tags().get("hsqe")); + Assertions.assertEquals(1077449031, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1916695552, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertTrue(response.properties().info().isDistributed()); + Assertions.assertEquals(1325957084, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("ng", response.properties().info().listener().dnsName()); + Assertions.assertEquals("xyxz", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(116645342, response.properties().info().listener().port()); + Assertions.assertEquals("ietbgnix", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("wwzkyf", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("xxij", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverMiLinkMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverMiLinkMockTests.java new file mode 100644 index 000000000000..98418d2193c2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverMiLinkMockTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.FailoverMiLinkResourceId; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsFailoverMiLinkMockTests { + @Test + public void testFailoverMiLink() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"okvjgbzsxebrslt\",\"serverName\":\"yhcdjwsuoardnag\",\"instanceName\":\"pufpbpgnrholhu\",\"vmId\":\"fwxi\",\"collectionTimestamp\":\"2020-12-29T20:16:55Z\",\"info\":{\"failureConditionLevel\":411525724,\"healthCheckTimeout\":1637733291,\"automatedBackupPreferenceDescription\":\"j\",\"version\":1371951498,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":false,\"isDistributed\":true,\"clusterTypeDescription\":\"tbbzj\",\"requiredSynchronizedSecondariesToCommit\":867601394,\"isContained\":false,\"primaryReplica\":\"zb\",\"primaryRecoveryHealthDescription\":\"cqzgihotjecohmx\",\"secondaryRecoveryHealthDescription\":\"lrrskap\",\"synchronizationHealthDescription\":\"wie\",\"replicationPartnerType\":\"AzureSQLVM\",\"listener\":{\"dnsName\":\"derltfokyksyim\",\"ipV4AddressesAndMasks\":[{},{},{},{}],\"ipV6Addresses\":[\"vkcxzznn\"],\"port\":852494517}},\"replicas\":{\"value\":[{\"replicaId\":\"jegprk\",\"replicaName\":\"uw\",\"replicaResourceId\":\"mwvvb\",\"configure\":{},\"state\":{}},{\"replicaId\":\"xximwgxq\",\"replicaName\":\"ekotjgxi\",\"replicaResourceId\":\"f\",\"configure\":{},\"state\":{}},{\"replicaId\":\"iwvjaqupbyyn\",\"replicaName\":\"kpajbmgeume\",\"replicaResourceId\":\"jbxcbccwkqmtxa\",\"configure\":{},\"state\":{}}],\"nextLink\":\"scrpilgftrqrej\"},\"databases\":{\"value\":[{\"databaseName\":\"qimlda\",\"replicaName\":\"fx\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"uadjnfs\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"iioshjgcz\",\"databaseStateDescription\":\"ybnxgztlcgc\",\"isSuspended\":true,\"suspendReasonDescription\":\"fjvmy\"},{\"databaseName\":\"zebecuvl\",\"replicaName\":\"fvwcljk\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"oxz\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"yxjijeypdvrbker\",\"databaseStateDescription\":\"dkgaw\",\"isSuspended\":true,\"suspendReasonDescription\":\"ildfk\"}],\"nextLink\":\"feygzqp\"},\"provisioningState\":\"Succeeded\"},\"location\":\"aybdjnxumentqon\",\"tags\":{\"wi\":\"ymxymu\",\"h\":\"qtow\",\"ajcywhjqw\":\"sycoybajasqub\",\"ymjzpwdlvwtiws\":\"chqohtfxcpupuk\"},\"id\":\"osaonhqnamppu\",\"name\":\"tassaekewna\",\"type\":\"eajbkajlcyizyddc\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .failoverMiLink("xu", "jgcq", "ulynkgfcfd", + new FailoverMiLinkResourceId().withManagedInstanceId("wsikxxtclhuulr").withForce(true), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("aybdjnxumentqon", response.location()); + Assertions.assertEquals("ymxymu", response.tags().get("wi")); + Assertions.assertEquals(411525724, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1637733291, response.properties().info().healthCheckTimeout()); + Assertions.assertTrue(response.properties().info().basicFeatures()); + Assertions.assertFalse(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertTrue(response.properties().info().isDistributed()); + Assertions.assertEquals(867601394, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(response.properties().info().isContained()); + Assertions.assertEquals("derltfokyksyim", response.properties().info().listener().dnsName()); + Assertions.assertEquals("vkcxzznn", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(852494517, response.properties().info().listener().port()); + Assertions.assertEquals("uw", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("mwvvb", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("qimlda", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverWithResponseMockTests.java new file mode 100644 index 000000000000..b52ef925de6a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsFailoverWithResponseMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsFailoverWithResponseMockTests { + @Test + public void testFailoverWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"vvlrlohewjjmajn\",\"serverName\":\"flqio\",\"instanceName\":\"waeqkzfzqxjosho\",\"vmId\":\"otryegp\",\"collectionTimestamp\":\"2021-09-12T20:17:39Z\",\"info\":{\"failureConditionLevel\":1971199048,\"healthCheckTimeout\":1069904883,\"automatedBackupPreferenceDescription\":\"lwkbfok\",\"version\":1238672912,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":true,\"isDistributed\":false,\"clusterTypeDescription\":\"blcdrmyf\",\"requiredSynchronizedSecondariesToCommit\":1613638320,\"isContained\":false,\"primaryReplica\":\"gyykyalug\",\"primaryRecoveryHealthDescription\":\"dfqnhttwdowrczfj\",\"secondaryRecoveryHealthDescription\":\"nuxxrkkm\",\"synchronizationHealthDescription\":\"nulwempdci\",\"replicationPartnerType\":\"Unknown\",\"listener\":{\"dnsName\":\"lrs\",\"ipV4AddressesAndMasks\":[{},{},{}],\"ipV6Addresses\":[\"flu\"],\"port\":1134501499}},\"replicas\":{\"value\":[{\"replicaId\":\"gzotfriyrgkoekvz\",\"replicaName\":\"xyxhighctxbxmo\",\"replicaResourceId\":\"cqydey\",\"configure\":{},\"state\":{}},{\"replicaId\":\"ic\",\"replicaName\":\"frjeizikgqaboohx\",\"replicaResourceId\":\"sgyc\",\"configure\":{},\"state\":{}}],\"nextLink\":\"mdvewuyqaeohpjh\"},\"databases\":{\"value\":[{\"databaseName\":\"vhhdaurgho\",\"replicaName\":\"aexbkhxjxjo\",\"isLocal\":false,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"kd\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"bekt\",\"databaseStateDescription\":\"o\",\"isSuspended\":false,\"suspendReasonDescription\":\"zamicb\"},{\"databaseName\":\"wcdgzsez\",\"replicaName\":\"xke\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"bmdlqjbed\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"lhupmomihzbdnpxp\",\"databaseStateDescription\":\"dpr\",\"isSuspended\":true,\"suspendReasonDescription\":\"lyicghflru\"}],\"nextLink\":\"sjygh\"},\"provisioningState\":\"xrkbhammgmqfmef\"},\"location\":\"qcpdwjgquxwey\",\"tags\":{\"cdjhunhg\":\"ndk\",\"sotirei\":\"cgawnrrnquo\"},\"id\":\"seob\",\"name\":\"sxstcyilbvzmm\",\"type\":\"cjzlquzexokjxebj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .failoverWithResponse("mhsurlgwqkpmm", "pstauol", "wiubmomsgvv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qcpdwjgquxwey", response.location()); + Assertions.assertEquals("ndk", response.tags().get("cdjhunhg")); + Assertions.assertEquals(1971199048, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1069904883, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertTrue(response.properties().info().dbFailover()); + Assertions.assertFalse(response.properties().info().isDistributed()); + Assertions.assertEquals(1613638320, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertFalse(response.properties().info().isContained()); + Assertions.assertEquals("lrs", response.properties().info().listener().dnsName()); + Assertions.assertEquals("flu", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1134501499, response.properties().info().listener().port()); + Assertions.assertEquals("xyxhighctxbxmo", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("cqydey", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("vhhdaurgho", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossWithResponseMockTests.java new file mode 100644 index 000000000000..3f31d6225b05 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsForceFailoverAllowDataLossWithResponseMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsForceFailoverAllowDataLossWithResponseMockTests { + @Test + public void testForceFailoverAllowDataLossWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"gi\",\"serverName\":\"wcehaqidoyzlt\",\"instanceName\":\"omqo\",\"vmId\":\"epiaeapfsergd\",\"collectionTimestamp\":\"2021-06-24T08:16:31Z\",\"info\":{\"failureConditionLevel\":820904630,\"healthCheckTimeout\":1593211468,\"automatedBackupPreferenceDescription\":\"eqwbpqqncjubkhj\",\"version\":1677252615,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":false,\"isDistributed\":false,\"clusterTypeDescription\":\"vqyvl\",\"requiredSynchronizedSecondariesToCommit\":1776924821,\"isContained\":true,\"primaryReplica\":\"ejbsvsiaies\",\"primaryRecoveryHealthDescription\":\"ddzydisnu\",\"secondaryRecoveryHealthDescription\":\"ywyjlnldpxot\",\"synchronizationHealthDescription\":\"iiaocqib\",\"replicationPartnerType\":\"AzureSQLVM\",\"listener\":{\"dnsName\":\"ee\",\"ipV4AddressesAndMasks\":[{}],\"ipV6Addresses\":[\"yv\"],\"port\":1924585618}},\"replicas\":{\"value\":[{\"replicaId\":\"sratjhdhzyb\",\"replicaName\":\"ijh\",\"replicaResourceId\":\"zgdkkagvwu\",\"configure\":{},\"state\":{}},{\"replicaId\":\"s\",\"replicaName\":\"orfmzhwilzz\",\"replicaResourceId\":\"ijmri\",\"configure\":{},\"state\":{}},{\"replicaId\":\"dneyttlr\",\"replicaName\":\"ivcbkutpumltwj\",\"replicaResourceId\":\"uxynb\",\"configure\":{},\"state\":{}}],\"nextLink\":\"qywauyqnjc\"},\"databases\":{\"value\":[{\"databaseName\":\"gjs\",\"replicaName\":\"ouarhwvixqqggljk\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"lrvtz\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"ctbhpjhxpcvrd\",\"databaseStateDescription\":\"eitaneqadynzjahw\",\"isSuspended\":true,\"suspendReasonDescription\":\"mzczfkicee\"},{\"databaseName\":\"a\",\"replicaName\":\"wspcaxikhfjqebg\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"zzromvygysemtmes\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"pinkzp\",\"databaseStateDescription\":\"qtdiswxspvckoj\",\"isSuspended\":false,\"suspendReasonDescription\":\"gspftesu\"}],\"nextLink\":\"pvpvd\"},\"provisioningState\":\"ytcovqs\"},\"location\":\"srfjbdxzfxnx\",\"tags\":{\"cy\":\"muoswkjmdih\"},\"id\":\"yzlwhbwzjnufzrf\",\"name\":\"m\",\"type\":\"qgnnbz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .forceFailoverAllowDataLossWithResponse("b", "inzabwmvoglj", "v", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("srfjbdxzfxnx", response.location()); + Assertions.assertEquals("muoswkjmdih", response.tags().get("cy")); + Assertions.assertEquals(820904630, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(1593211468, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertFalse(response.properties().info().isDistributed()); + Assertions.assertEquals(1776924821, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("ee", response.properties().info().listener().dnsName()); + Assertions.assertEquals("yv", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(1924585618, response.properties().info().listener().port()); + Assertions.assertEquals("ijh", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("zgdkkagvwu", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("gjs", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetWithResponseMockTests.java new file mode 100644 index 000000000000..725ea5bc7e3c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsGetWithResponseMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"glq\",\"serverName\":\"kn\",\"instanceName\":\"clctzey\",\"vmId\":\"mndcov\",\"collectionTimestamp\":\"2021-02-28T02:25:50Z\",\"info\":{\"failureConditionLevel\":907193872,\"healthCheckTimeout\":373844350,\"automatedBackupPreferenceDescription\":\"nhmkvfruwku\",\"version\":1954329686,\"basicFeatures\":true,\"dtcSupport\":true,\"dbFailover\":false,\"isDistributed\":false,\"clusterTypeDescription\":\"emebunaucmc\",\"requiredSynchronizedSecondariesToCommit\":1750008323,\"isContained\":true,\"primaryReplica\":\"mmjauw\",\"primaryRecoveryHealthDescription\":\"xefnohaitrani\",\"secondaryRecoveryHealthDescription\":\"rwgudasmxub\",\"synchronizationHealthDescription\":\"bngfcocefhpri\",\"replicationPartnerType\":\"AzureSQLManagedInstance\",\"listener\":{\"dnsName\":\"ztraud\",\"ipV4AddressesAndMasks\":[{},{}],\"ipV6Addresses\":[\"dculregp\",\"tmojhvrztnvgyshq\"],\"port\":603584443}},\"replicas\":{\"value\":[{\"replicaId\":\"ewjzl\",\"replicaName\":\"kcfazzw\",\"replicaResourceId\":\"ayerzrran\",\"configure\":{},\"state\":{}},{\"replicaId\":\"lpolwzrghsrle\",\"replicaName\":\"kfscjfncjwv\",\"replicaResourceId\":\"gfqwtltngvmreupt\",\"configure\":{},\"state\":{}},{\"replicaId\":\"m\",\"replicaName\":\"ajwolxfs\",\"replicaResourceId\":\"ghmp\",\"configure\":{},\"state\":{}}],\"nextLink\":\"slrcigtzj\"},\"databases\":{\"value\":[{\"databaseName\":\"lapsnsso\",\"replicaName\":\"xpavid\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"fcvvy\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"puxgcbdsvalpnpt\",\"databaseStateDescription\":\"rkxgpazwugxyqvnj\",\"isSuspended\":true,\"suspendReasonDescription\":\"lhld\"},{\"databaseName\":\"hzzgqlmfa\",\"replicaName\":\"z\",\"isLocal\":true,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"xpqh\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"nmhkrezsd\",\"databaseStateDescription\":\"xheq\",\"isSuspended\":true,\"suspendReasonDescription\":\"uxsp\"}],\"nextLink\":\"ymmqgwokmikp\"},\"provisioningState\":\"fbmjxuvji\"},\"location\":\"dvhaxdvw\",\"tags\":{\"etatlakf\":\"hpphthdklm\",\"vtooxrpo\":\"oixwgiksb\",\"chgjtnhtukfacih\":\"wp\",\"bnuvwcg\":\"bfntumeezbxvq\"},\"id\":\"sgomtmjz\",\"name\":\"xuqgovsxpwwztj\",\"type\":\"mkkhtgfredml\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .getWithResponse("ewfopazdazg", "sqgpewqcfu", "mdpv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dvhaxdvw", response.location()); + Assertions.assertEquals("hpphthdklm", response.tags().get("etatlakf")); + Assertions.assertEquals(907193872, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(373844350, response.properties().info().healthCheckTimeout()); + Assertions.assertTrue(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertFalse(response.properties().info().dbFailover()); + Assertions.assertFalse(response.properties().info().isDistributed()); + Assertions.assertEquals(1750008323, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("ztraud", response.properties().info().listener().dnsName()); + Assertions.assertEquals("dculregp", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(603584443, response.properties().info().listener().port()); + Assertions.assertEquals("kcfazzw", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("ayerzrran", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("lapsnsso", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListMockTests.java new file mode 100644 index 000000000000..67c1111aeab9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsListMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"availabilityGroupId\":\"jowazhpab\",\"serverName\":\"o\",\"instanceName\":\"yotgkwsxnsrqorc\",\"vmId\":\"nmvceb\",\"collectionTimestamp\":\"2021-10-03T18:58:14Z\",\"info\":{\"failureConditionLevel\":2038270605,\"healthCheckTimeout\":1520987150,\"automatedBackupPreferenceDescription\":\"xxqn\",\"version\":477671408,\"basicFeatures\":true,\"dtcSupport\":false,\"dbFailover\":true,\"isDistributed\":true,\"clusterTypeDescription\":\"gojmrvvxwjon\",\"requiredSynchronizedSecondariesToCommit\":472131815,\"isContained\":true,\"primaryReplica\":\"q\",\"primaryRecoveryHealthDescription\":\"ilcchskxxkansbvr\",\"secondaryRecoveryHealthDescription\":\"qgvtojrulfu\",\"synchronizationHealthDescription\":\"ejrthcfjzhxlyub\",\"replicationPartnerType\":\"Unknown\",\"listener\":{\"dnsName\":\"tvrjeqmtz\",\"ipV4AddressesAndMasks\":[{},{},{},{}],\"ipV6Addresses\":[\"ztr\",\"alx\",\"d\",\"absr\"],\"port\":281811591}},\"replicas\":{\"value\":[{\"replicaId\":\"qatiwkkvyanxkvvc\",\"replicaName\":\"msvuvdjkqxetq\",\"replicaResourceId\":\"livrjjxnwx\",\"configure\":{},\"state\":{}},{\"replicaId\":\"ojxl\",\"replicaName\":\"z\",\"replicaResourceId\":\"pgfquwzpwiibelwc\",\"configure\":{},\"state\":{}},{\"replicaId\":\"w\",\"replicaName\":\"jxljtxbusq\",\"replicaResourceId\":\"xxniuisdzhgbd\",\"configure\":{},\"state\":{}},{\"replicaId\":\"gsecnadbuwqrgx\",\"replicaName\":\"lmqiynezoel\",\"replicaResourceId\":\"kki\",\"configure\":{},\"state\":{}}],\"nextLink\":\"tumxpymdj\"},\"databases\":{\"value\":[{\"databaseName\":\"oqvqpilr\",\"replicaName\":\"ncanlduwzor\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"qk\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"x\",\"databaseStateDescription\":\"vfqepd\",\"isSuspended\":false,\"suspendReasonDescription\":\"uubwyvpjb\"}],\"nextLink\":\"cpj\"},\"provisioningState\":\"uqgixex\"},\"location\":\"dfbwljav\",\"tags\":{\"vrg\":\"rkjd\",\"biiftksdwgdnk\":\"iegftc\"},\"id\":\"fgmwd\",\"name\":\"c\",\"type\":\"buvczldbglzoutb\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.sqlServerAvailabilityGroups().list("cgrllc", "na", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("dfbwljav", response.iterator().next().location()); + Assertions.assertEquals("rkjd", response.iterator().next().tags().get("vrg")); + Assertions.assertEquals(2038270605, response.iterator().next().properties().info().failureConditionLevel()); + Assertions.assertEquals(1520987150, response.iterator().next().properties().info().healthCheckTimeout()); + Assertions.assertTrue(response.iterator().next().properties().info().basicFeatures()); + Assertions.assertFalse(response.iterator().next().properties().info().dtcSupport()); + Assertions.assertTrue(response.iterator().next().properties().info().dbFailover()); + Assertions.assertTrue(response.iterator().next().properties().info().isDistributed()); + Assertions.assertEquals(472131815, + response.iterator().next().properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.iterator().next().properties().info().isContained()); + Assertions.assertEquals("tvrjeqmtz", response.iterator().next().properties().info().listener().dnsName()); + Assertions.assertEquals("ztr", + response.iterator().next().properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(281811591, response.iterator().next().properties().info().listener().port()); + Assertions.assertEquals("msvuvdjkqxetq", + response.iterator().next().properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("livrjjxnwx", + response.iterator().next().properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("oqvqpilr", + response.iterator().next().properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesWithResponseMockTests.java new file mode 100644 index 000000000000..a87ff39db734 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerAvailabilityGroupsRemoveDatabasesWithResponseMockTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.Databases; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerAvailabilityGroupsRemoveDatabasesWithResponseMockTests { + @Test + public void testRemoveDatabasesWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"availabilityGroupId\":\"jnosdkv\",\"serverName\":\"fasgm\",\"instanceName\":\"rnzpducdaak\",\"vmId\":\"jktzboimyfpq\",\"collectionTimestamp\":\"2021-06-16T02:40Z\",\"info\":{\"failureConditionLevel\":711539950,\"healthCheckTimeout\":374184878,\"automatedBackupPreferenceDescription\":\"ytfvpctfji\",\"version\":415610947,\"basicFeatures\":false,\"dtcSupport\":true,\"dbFailover\":true,\"isDistributed\":true,\"clusterTypeDescription\":\"h\",\"requiredSynchronizedSecondariesToCommit\":1025024432,\"isContained\":true,\"primaryReplica\":\"kejj\",\"primaryRecoveryHealthDescription\":\"igaw\",\"secondaryRecoveryHealthDescription\":\"zmxjqif\",\"synchronizationHealthDescription\":\"jjsbcmlzaahzbhur\",\"replicationPartnerType\":\"AzureSQLManagedInstance\",\"listener\":{\"dnsName\":\"lirh\",\"ipV4AddressesAndMasks\":[{},{},{},{}],\"ipV6Addresses\":[\"su\",\"gfjzcvaax\",\"ia\",\"ahfxwccok\"],\"port\":800423098}},\"replicas\":{\"value\":[{\"replicaId\":\"c\",\"replicaName\":\"nuhhoqeqshav\",\"replicaResourceId\":\"q\",\"configure\":{},\"state\":{}},{\"replicaId\":\"qolnthbbn\",\"replicaName\":\"zukwdrnzkj\",\"replicaResourceId\":\"fceyjn\",\"configure\":{},\"state\":{}},{\"replicaId\":\"fuyf\",\"replicaName\":\"pfiddhl\",\"replicaResourceId\":\"fz\",\"configure\":{},\"state\":{}}],\"nextLink\":\"mq\"},\"databases\":{\"value\":[{\"databaseName\":\"cuselq\",\"replicaName\":\"sazrhxuddqmdtff\",\"isLocal\":false,\"isPrimaryReplica\":true,\"synchronizationStateDescription\":\"khmwdmd\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"ixokwtjawhv\",\"databaseStateDescription\":\"nqf\",\"isSuspended\":false,\"suspendReasonDescription\":\"cvmyolcaymjchtv\"},{\"databaseName\":\"vlaqdnzyzawa\",\"replicaName\":\"wqkokbczothymg\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"nwgwimaanea\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"ho\",\"databaseStateDescription\":\"yanrfvq\",\"isSuspended\":true,\"suspendReasonDescription\":\"gvoogxkfna\"},{\"databaseName\":\"qymhcctopuow\",\"replicaName\":\"nskby\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"ygxvha\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"cxq\",\"databaseStateDescription\":\"hscozawmvgxsmpk\",\"isSuspended\":false,\"suspendReasonDescription\":\"rfljfewxq\"}],\"nextLink\":\"oxudnmckap\"},\"provisioningState\":\"knq\"},\"location\":\"jgencdgmoque\",\"tags\":{\"ltjouwhldxwh\":\"kkyo\",\"q\":\"epr\",\"cvprst\":\"smfx\"},\"id\":\"kitbfjtd\",\"name\":\"otnplfacqocc\",\"type\":\"rqxw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerAvailabilityGroupResource response = manager.sqlServerAvailabilityGroups() + .removeDatabasesWithResponse("xo", "krvfsxxbydes", "lvgecpwgoljtz", + new Databases().withValues(Arrays.asList("xsdobygoogxqapjx", "azyj", "ucsa")), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("jgencdgmoque", response.location()); + Assertions.assertEquals("kkyo", response.tags().get("ltjouwhldxwh")); + Assertions.assertEquals(711539950, response.properties().info().failureConditionLevel()); + Assertions.assertEquals(374184878, response.properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.properties().info().basicFeatures()); + Assertions.assertTrue(response.properties().info().dtcSupport()); + Assertions.assertTrue(response.properties().info().dbFailover()); + Assertions.assertTrue(response.properties().info().isDistributed()); + Assertions.assertEquals(1025024432, response.properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.properties().info().isContained()); + Assertions.assertEquals("lirh", response.properties().info().listener().dnsName()); + Assertions.assertEquals("su", response.properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(800423098, response.properties().info().listener().port()); + Assertions.assertEquals("nuhhoqeqshav", response.properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("q", response.properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("cuselq", response.properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourceInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourceInnerTests.java new file mode 100644 index 000000000000..eef117166706 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourceInnerTests.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerDatabaseResourceInner; +import com.azure.resourcemanager.azurearcdata.models.AdditionalMigrationJobAttributes; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigration; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseMigrationJobsItem; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.MigrationStatus; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerDatabaseResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerDatabaseResourceInner model = BinaryData.fromString( + "{\"properties\":{\"collationName\":\"mczjkm\",\"databaseCreationDate\":\"2021-07-07T11:09:52Z\",\"compatibilityLevel\":171178668,\"sizeMB\":31.065694026746204,\"logFileSizeMB\":37.53178393749286,\"dataFileSizeMB\":7.394517893598362,\"spaceAvailableMB\":97.62434141723534,\"state\":\"Suspect\",\"isReadOnly\":false,\"recoveryMode\":\"Full\",\"databaseOptions\":{\"isAutoCloseOn\":true,\"isAutoShrinkOn\":true,\"isAutoCreateStatsOn\":false,\"isAutoUpdateStatsOn\":true,\"isRemoteDataArchiveEnabled\":true,\"isMemoryOptimizationEnabled\":true,\"isEncrypted\":true,\"isTrustworthyOn\":false,\"isHekatonFilesOn\":true,\"numberOfHekatonFiles\":289344898},\"backupInformation\":{\"lastFullBackup\":\"2021-08-22T14:25:02Z\",\"lastLogBackup\":\"2021-05-28T23:16:03Z\"},\"backupPolicy\":{\"retentionPeriodDays\":1865358517,\"fullBackupDays\":2014175583,\"differentialBackupHours\":24,\"transactionLogBackupMinutes\":521498436},\"earliestRestoreDate\":\"2021-06-08T10:08:27Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"ydiw\",\"vmId\":\"rkwpzdqtvhcspod\",\"restorePointInTime\":\"2021-04-20T18:33:38Z\",\"provisioningState\":\"sipi\",\"lastDatabaseUploadTime\":\"2021-05-17T09:13:45Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-10-18T18:39:59Z\",\"targetRecommendationGenerationTime\":\"2021-11-20T13:28:07Z\",\"databaseAssessments\":[{\"appliesToMigrationTargetPlatform\":\"oichdlpnfpubnt\",\"featureId\":\"atzviqsowsaael\",\"issueCategory\":\"ttcjuhplrvkmjc\",\"moreInformation\":\"jvlgfggcvkyyliz\"},{\"appliesToMigrationTargetPlatform\":\"bjpsfxsfuztlvtm\",\"featureId\":\"gbwidqlvh\",\"issueCategory\":\"oveofizrvjfnmj\",\"moreInformation\":\"lwyzgib\"}],\"targetReadiness\":{\"azureSqlDatabase\":{\"numOfBlockerIssues\":1720113611,\"recommendationStatus\":\"ReadyWithConditions\",\"impactedObjectsSummary\":[{},{},{},{}],\"monthlyCost\":{},\"monthlyCostOptions\":[{},{},{}],\"targetSku\":{}},\"azureSqlManagedInstance\":{\"numOfBlockerIssues\":687625803,\"recommendationStatus\":\"ReadyWithConditions\",\"impactedObjectsSummary\":[{},{},{},{}],\"monthlyCost\":{},\"monthlyCostOptions\":[{},{},{},{}],\"targetSku\":{}},\"azureSqlVirtualMachine\":{\"numOfBlockerIssues\":585656811,\"recommendationStatus\":\"Unknown\",\"impactedObjectsSummary\":[{},{},{},{}],\"monthlyCost\":{},\"monthlyCostOptions\":[{},{},{}],\"targetSku\":{}}}},\"jobs\":[{\"migrationTrackingId\":\"kl\",\"migrationMode\":\"Logical\",\"initiatedFrom\":\"DMS-Portal\",\"status\":\"Failed\",\"lastError\":\"k\",\"targetType\":\"AzureSqlManagedInstance\",\"targetResourceId\":\"o\",\"startTime\":\"2021-05-15T23:12:25Z\",\"endTime\":\"2021-11-28T18:49:09Z\",\"additionalAttributes\":[{}]},{\"migrationTrackingId\":\"wtrhtgv\",\"migrationMode\":\"Other\",\"initiatedFrom\":\"SSMA\",\"status\":\"InProgress\",\"lastError\":\"lawjmjsmwrok\",\"targetType\":\"AzureSqlManagedInstance\",\"targetResourceId\":\"zzzwy\",\"startTime\":\"2021-04-08T08:13:20Z\",\"endTime\":\"2021-09-06T04:14:54Z\",\"additionalAttributes\":[{},{},{},{}]},{\"migrationTrackingId\":\"uy\",\"migrationMode\":\"Other\",\"initiatedFrom\":\"DMS-CLI\",\"status\":\"Unknown\",\"lastError\":\"txd\",\"targetType\":\"AzureSqlDatabase\",\"targetResourceId\":\"zusg\",\"startTime\":\"2021-07-12T17:26:51Z\",\"endTime\":\"2021-05-04T04:08:29Z\",\"additionalAttributes\":[{}]},{\"migrationTrackingId\":\"zfpafolpymwamxqz\",\"migrationMode\":\"Logical\",\"initiatedFrom\":\"DMS-CLI\",\"status\":\"Unknown\",\"lastError\":\"t\",\"targetType\":\"AzureSqlDatabase\",\"targetResourceId\":\"a\",\"startTime\":\"2021-09-16T17:21:57Z\",\"endTime\":\"2021-06-22T02:25:12Z\",\"additionalAttributes\":[{},{},{}]}]}},\"location\":\"srlzknmzlan\",\"tags\":{\"phcnzqtpj\":\"dwv\",\"iwdcxsmlzzhzd\":\"mqrhvthl\",\"n\":\"xetlgydlhqv\"},\"id\":\"pxy\",\"name\":\"afiqgeaarbgjekg\",\"type\":\"klbyulidwcw\"}") + .toObject(SqlServerDatabaseResourceInner.class); + Assertions.assertEquals("srlzknmzlan", model.location()); + Assertions.assertEquals("dwv", model.tags().get("phcnzqtpj")); + Assertions.assertEquals("mczjkm", model.properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-07T11:09:52Z"), + model.properties().databaseCreationDate()); + Assertions.assertEquals(171178668, model.properties().compatibilityLevel()); + Assertions.assertEquals(31.065694026746204D, model.properties().sizeMB()); + Assertions.assertEquals(37.53178393749286D, model.properties().logFileSizeMB()); + Assertions.assertEquals(7.394517893598362D, model.properties().dataFileSizeMB()); + Assertions.assertEquals(97.62434141723534D, model.properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.SUSPECT, model.properties().state()); + Assertions.assertFalse(model.properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.FULL, model.properties().recoveryMode()); + Assertions.assertTrue(model.properties().databaseOptions().isAutoCloseOn()); + Assertions.assertTrue(model.properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertTrue(model.properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertTrue(model.properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertTrue(model.properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertTrue(model.properties().databaseOptions().isEncrypted()); + Assertions.assertFalse(model.properties().databaseOptions().isTrustworthyOn()); + Assertions.assertTrue(model.properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(289344898, model.properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-22T14:25:02Z"), + model.properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T23:16:03Z"), + model.properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(1865358517, model.properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(2014175583, model.properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWENTY_FOUR, + model.properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(521498436, model.properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.POINT_IN_TIME_RESTORE, model.properties().createMode()); + Assertions.assertEquals("ydiw", model.properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-20T18:33:38Z"), model.properties().restorePointInTime()); + Assertions.assertEquals("kl", model.properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.LOGICAL, model.properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.DMSPORTAL, model.properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.FAILED, model.properties().migration().jobs().get(0).status()); + Assertions.assertEquals("k", model.properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_MANAGED_INSTANCE, + model.properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("o", model.properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-15T23:12:25Z"), + model.properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-28T18:49:09Z"), + model.properties().migration().jobs().get(0).endTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerDatabaseResourceInner model = new SqlServerDatabaseResourceInner().withLocation("srlzknmzlan") + .withTags(mapOf("phcnzqtpj", "dwv", "iwdcxsmlzzhzd", "mqrhvthl", "n", "xetlgydlhqv")) + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("mczjkm") + .withDatabaseCreationDate(OffsetDateTime.parse("2021-07-07T11:09:52Z")) + .withCompatibilityLevel(171178668) + .withSizeMB(31.065694026746204D) + .withLogFileSizeMB(37.53178393749286D) + .withDataFileSizeMB(7.394517893598362D) + .withSpaceAvailableMB(97.62434141723534D) + .withState(DatabaseState.SUSPECT) + .withIsReadOnly(false) + .withRecoveryMode(RecoveryMode.FULL) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(true) + .withIsAutoShrinkOn(true) + .withIsAutoCreateStatsOn(false) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(true) + .withIsMemoryOptimizationEnabled(true) + .withIsEncrypted(true) + .withIsTrustworthyOn(false) + .withIsHekatonFilesOn(true) + .withNumberOfHekatonFiles(289344898)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2021-08-22T14:25:02Z")) + .withLastLogBackup(OffsetDateTime.parse("2021-05-28T23:16:03Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1865358517) + .withFullBackupDays(2014175583) + .withDifferentialBackupHours(DifferentialBackupHours.TWENTY_FOUR) + .withTransactionLogBackupMinutes(521498436)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId("ydiw") + .withRestorePointInTime(OffsetDateTime.parse("2021-04-20T18:33:38Z")) + .withMigration(new DataBaseMigration().withAssessment(new DataBaseMigrationAssessment()) + .withJobs(Arrays.asList( + new DatabaseMigrationJobsItem().withMigrationTrackingId("kl") + .withMigrationMode(MigrationMode.LOGICAL) + .withInitiatedFrom(InitiatedFrom.DMSPORTAL) + .withStatus(MigrationStatus.FAILED) + .withLastError("k") + .withTargetType(TargetType.AZURE_SQL_MANAGED_INSTANCE) + .withTargetResourceId("o") + .withStartTime(OffsetDateTime.parse("2021-05-15T23:12:25Z")) + .withEndTime(OffsetDateTime.parse("2021-11-28T18:49:09Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes())), + new DatabaseMigrationJobsItem().withMigrationTrackingId("wtrhtgv") + .withMigrationMode(MigrationMode.OTHER) + .withInitiatedFrom(InitiatedFrom.SSMA) + .withStatus(MigrationStatus.IN_PROGRESS) + .withLastError("lawjmjsmwrok") + .withTargetType(TargetType.AZURE_SQL_MANAGED_INSTANCE) + .withTargetResourceId("zzzwy") + .withStartTime(OffsetDateTime.parse("2021-04-08T08:13:20Z")) + .withEndTime(OffsetDateTime.parse("2021-09-06T04:14:54Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes(), new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes())), + new DatabaseMigrationJobsItem().withMigrationTrackingId("uy") + .withMigrationMode(MigrationMode.OTHER) + .withInitiatedFrom(InitiatedFrom.DMSCLI) + .withStatus(MigrationStatus.UNKNOWN) + .withLastError("txd") + .withTargetType(TargetType.AZURE_SQL_DATABASE) + .withTargetResourceId("zusg") + .withStartTime(OffsetDateTime.parse("2021-07-12T17:26:51Z")) + .withEndTime(OffsetDateTime.parse("2021-05-04T04:08:29Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes())), + new DatabaseMigrationJobsItem().withMigrationTrackingId("zfpafolpymwamxqz") + .withMigrationMode(MigrationMode.LOGICAL) + .withInitiatedFrom(InitiatedFrom.DMSCLI) + .withStatus(MigrationStatus.UNKNOWN) + .withLastError("t") + .withTargetType(TargetType.AZURE_SQL_DATABASE) + .withTargetResourceId("a") + .withStartTime(OffsetDateTime.parse("2021-09-16T17:21:57Z")) + .withEndTime(OffsetDateTime.parse("2021-06-22T02:25:12Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes(), new AdditionalMigrationJobAttributes())))))); + model = BinaryData.fromObject(model).toObject(SqlServerDatabaseResourceInner.class); + Assertions.assertEquals("srlzknmzlan", model.location()); + Assertions.assertEquals("dwv", model.tags().get("phcnzqtpj")); + Assertions.assertEquals("mczjkm", model.properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-07T11:09:52Z"), + model.properties().databaseCreationDate()); + Assertions.assertEquals(171178668, model.properties().compatibilityLevel()); + Assertions.assertEquals(31.065694026746204D, model.properties().sizeMB()); + Assertions.assertEquals(37.53178393749286D, model.properties().logFileSizeMB()); + Assertions.assertEquals(7.394517893598362D, model.properties().dataFileSizeMB()); + Assertions.assertEquals(97.62434141723534D, model.properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.SUSPECT, model.properties().state()); + Assertions.assertFalse(model.properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.FULL, model.properties().recoveryMode()); + Assertions.assertTrue(model.properties().databaseOptions().isAutoCloseOn()); + Assertions.assertTrue(model.properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertTrue(model.properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertTrue(model.properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertTrue(model.properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertTrue(model.properties().databaseOptions().isEncrypted()); + Assertions.assertFalse(model.properties().databaseOptions().isTrustworthyOn()); + Assertions.assertTrue(model.properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(289344898, model.properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-22T14:25:02Z"), + model.properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T23:16:03Z"), + model.properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(1865358517, model.properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(2014175583, model.properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWENTY_FOUR, + model.properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(521498436, model.properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.POINT_IN_TIME_RESTORE, model.properties().createMode()); + Assertions.assertEquals("ydiw", model.properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-20T18:33:38Z"), model.properties().restorePointInTime()); + Assertions.assertEquals("kl", model.properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.LOGICAL, model.properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.DMSPORTAL, model.properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.FAILED, model.properties().migration().jobs().get(0).status()); + Assertions.assertEquals("k", model.properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_MANAGED_INSTANCE, + model.properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("o", model.properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-15T23:12:25Z"), + model.properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-28T18:49:09Z"), + model.properties().migration().jobs().get(0).endTime()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourcePropertiesBackupInformationTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourcePropertiesBackupInformationTests.java new file mode 100644 index 000000000000..87b1acf70103 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourcePropertiesBackupInformationTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerDatabaseResourcePropertiesBackupInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerDatabaseResourcePropertiesBackupInformation model = BinaryData + .fromString("{\"lastFullBackup\":\"2021-02-09T15:24:56Z\",\"lastLogBackup\":\"2021-04-15T13:14:34Z\"}") + .toObject(SqlServerDatabaseResourcePropertiesBackupInformation.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-09T15:24:56Z"), model.lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T13:14:34Z"), model.lastLogBackup()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerDatabaseResourcePropertiesBackupInformation model + = new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2021-02-09T15:24:56Z")) + .withLastLogBackup(OffsetDateTime.parse("2021-04-15T13:14:34Z")); + model = BinaryData.fromObject(model).toObject(SqlServerDatabaseResourcePropertiesBackupInformation.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-09T15:24:56Z"), model.lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T13:14:34Z"), model.lastLogBackup()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourcePropertiesDatabaseOptionsTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourcePropertiesDatabaseOptionsTests.java new file mode 100644 index 000000000000..8c256927935a --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseResourcePropertiesDatabaseOptionsTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerDatabaseResourcePropertiesDatabaseOptionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerDatabaseResourcePropertiesDatabaseOptions model = BinaryData.fromString( + "{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":false,\"isAutoCreateStatsOn\":true,\"isAutoUpdateStatsOn\":true,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":false,\"isEncrypted\":true,\"isTrustworthyOn\":false,\"isHekatonFilesOn\":true,\"numberOfHekatonFiles\":1541422170}") + .toObject(SqlServerDatabaseResourcePropertiesDatabaseOptions.class); + Assertions.assertFalse(model.isAutoCloseOn()); + Assertions.assertFalse(model.isAutoShrinkOn()); + Assertions.assertTrue(model.isAutoCreateStatsOn()); + Assertions.assertTrue(model.isAutoUpdateStatsOn()); + Assertions.assertFalse(model.isRemoteDataArchiveEnabled()); + Assertions.assertFalse(model.isMemoryOptimizationEnabled()); + Assertions.assertTrue(model.isEncrypted()); + Assertions.assertFalse(model.isTrustworthyOn()); + Assertions.assertTrue(model.isHekatonFilesOn()); + Assertions.assertEquals(1541422170, model.numberOfHekatonFiles()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerDatabaseResourcePropertiesDatabaseOptions model + = new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(false) + .withIsAutoShrinkOn(false) + .withIsAutoCreateStatsOn(true) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(false) + .withIsMemoryOptimizationEnabled(false) + .withIsEncrypted(true) + .withIsTrustworthyOn(false) + .withIsHekatonFilesOn(true) + .withNumberOfHekatonFiles(1541422170); + model = BinaryData.fromObject(model).toObject(SqlServerDatabaseResourcePropertiesDatabaseOptions.class); + Assertions.assertFalse(model.isAutoCloseOn()); + Assertions.assertFalse(model.isAutoShrinkOn()); + Assertions.assertTrue(model.isAutoCreateStatsOn()); + Assertions.assertTrue(model.isAutoUpdateStatsOn()); + Assertions.assertFalse(model.isRemoteDataArchiveEnabled()); + Assertions.assertFalse(model.isMemoryOptimizationEnabled()); + Assertions.assertTrue(model.isEncrypted()); + Assertions.assertFalse(model.isTrustworthyOn()); + Assertions.assertTrue(model.isHekatonFilesOn()); + Assertions.assertEquals(1541422170, model.numberOfHekatonFiles()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseUpdateTests.java new file mode 100644 index 000000000000..845c1d949e10 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabaseUpdateTests.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AdditionalMigrationJobAttributes; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigration; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseMigrationJobsItem; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.MigrationStatus; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseUpdate; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerDatabaseUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerDatabaseUpdate model = BinaryData.fromString( + "{\"tags\":{\"unwqr\":\"joqza\"},\"properties\":{\"collationName\":\"rg\",\"databaseCreationDate\":\"2021-03-07T07:18:21Z\",\"compatibilityLevel\":1875104769,\"sizeMB\":76.53575004425825,\"logFileSizeMB\":6.536424149627907,\"dataFileSizeMB\":90.61409980474623,\"spaceAvailableMB\":86.74818091970705,\"state\":\"Offline\",\"isReadOnly\":true,\"recoveryMode\":\"Simple\",\"databaseOptions\":{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":false,\"isAutoCreateStatsOn\":false,\"isAutoUpdateStatsOn\":false,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":false,\"isEncrypted\":true,\"isTrustworthyOn\":false,\"isHekatonFilesOn\":false,\"numberOfHekatonFiles\":34796750},\"backupInformation\":{\"lastFullBackup\":\"2021-07-26T11:57:58Z\",\"lastLogBackup\":\"2020-12-23T03:02:40Z\"},\"backupPolicy\":{\"retentionPeriodDays\":1064315343,\"fullBackupDays\":1892666564,\"differentialBackupHours\":12,\"transactionLogBackupMinutes\":1794200492},\"earliestRestoreDate\":\"2021-09-29T03:44:32Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"yunssx\",\"vmId\":\"hi\",\"restorePointInTime\":\"2021-07-11T09:36:08Z\",\"provisioningState\":\"lgvvpaseksgbu\",\"lastDatabaseUploadTime\":\"2021-12-10T10:46:48Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-08-24T15:42:08Z\",\"targetRecommendationGenerationTime\":\"2021-11-27T22:52:23Z\",\"databaseAssessments\":[{\"appliesToMigrationTargetPlatform\":\"i\",\"featureId\":\"rpiwrqofulo\",\"issueCategory\":\"jnlex\",\"moreInformation\":\"cbjpibkephuu\"}],\"targetReadiness\":{\"azureSqlDatabase\":{\"numOfBlockerIssues\":135322620,\"recommendationStatus\":\"Ready\",\"impactedObjectsSummary\":[{},{},{}],\"monthlyCost\":{},\"monthlyCostOptions\":[{},{}],\"targetSku\":{}},\"azureSqlManagedInstance\":{\"numOfBlockerIssues\":2087275634,\"recommendationStatus\":\"ReadyWithConditions\",\"impactedObjectsSummary\":[{},{},{},{}],\"monthlyCost\":{},\"monthlyCostOptions\":[{},{},{},{}],\"targetSku\":{}},\"azureSqlVirtualMachine\":{\"numOfBlockerIssues\":1819978929,\"recommendationStatus\":\"NotReady\",\"impactedObjectsSummary\":[{},{}],\"monthlyCost\":{},\"monthlyCostOptions\":[{}],\"targetSku\":{}}}},\"jobs\":[{\"migrationTrackingId\":\"rpcjttbstvjeaqnr\",\"migrationMode\":\"Other\",\"initiatedFrom\":\"DMS-Portal\",\"status\":\"InProgress\",\"lastError\":\"lghktuidvrm\",\"targetType\":\"AzureSqlVirtualMachine\",\"targetResourceId\":\"dwwexymz\",\"startTime\":\"2021-08-09T21:29:39Z\",\"endTime\":\"2021-01-04T09:47:37Z\",\"additionalAttributes\":[{},{},{}]},{\"migrationTrackingId\":\"pwvqsgnyyu\",\"migrationMode\":\"MILink\",\"initiatedFrom\":\"SSMA\",\"status\":\"InProgressWithWarnings\",\"lastError\":\"pmeyyvpkpatlbijp\",\"targetType\":\"AzureSqlManagedInstance\",\"targetResourceId\":\"srfhf\",\"startTime\":\"2021-05-25T20:54:06Z\",\"endTime\":\"2021-01-30T11:52:58Z\",\"additionalAttributes\":[{},{}]},{\"migrationTrackingId\":\"xwcdomm\",\"migrationMode\":\"LogShipping\",\"initiatedFrom\":\"DMS-Portal\",\"status\":\"Successful\",\"lastError\":\"gbrt\",\"targetType\":\"AzureSqlManagedInstance\",\"targetResourceId\":\"clkiexhajl\",\"startTime\":\"2021-09-28T09:45:01Z\",\"endTime\":\"2021-10-01T04:07:55Z\",\"additionalAttributes\":[{}]},{\"migrationTrackingId\":\"uttdiygbp\",\"migrationMode\":\"LogShipping\",\"initiatedFrom\":\"Azure Arc\",\"status\":\"Successful\",\"lastError\":\"k\",\"targetType\":\"AzureSqlDatabase\",\"targetResourceId\":\"wgzwxjlmecvog\",\"startTime\":\"2021-10-25T06:31:18Z\",\"endTime\":\"2021-07-17T14:20:46Z\",\"additionalAttributes\":[{},{},{},{}]}]}}}") + .toObject(SqlServerDatabaseUpdate.class); + Assertions.assertEquals("joqza", model.tags().get("unwqr")); + Assertions.assertEquals("rg", model.properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-07T07:18:21Z"), + model.properties().databaseCreationDate()); + Assertions.assertEquals(1875104769, model.properties().compatibilityLevel()); + Assertions.assertEquals(76.53575004425825D, model.properties().sizeMB()); + Assertions.assertEquals(6.536424149627907D, model.properties().logFileSizeMB()); + Assertions.assertEquals(90.61409980474623D, model.properties().dataFileSizeMB()); + Assertions.assertEquals(86.74818091970705D, model.properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.OFFLINE, model.properties().state()); + Assertions.assertTrue(model.properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.SIMPLE, model.properties().recoveryMode()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoCloseOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertFalse(model.properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertFalse(model.properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertTrue(model.properties().databaseOptions().isEncrypted()); + Assertions.assertFalse(model.properties().databaseOptions().isTrustworthyOn()); + Assertions.assertFalse(model.properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(34796750, model.properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T11:57:58Z"), + model.properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T03:02:40Z"), + model.properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(1064315343, model.properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(1892666564, model.properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWELVE, + model.properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(1794200492, model.properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.POINT_IN_TIME_RESTORE, model.properties().createMode()); + Assertions.assertEquals("yunssx", model.properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-11T09:36:08Z"), model.properties().restorePointInTime()); + Assertions.assertEquals("rpcjttbstvjeaqnr", model.properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.OTHER, model.properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.DMSPORTAL, model.properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.IN_PROGRESS, model.properties().migration().jobs().get(0).status()); + Assertions.assertEquals("lghktuidvrm", model.properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_VIRTUAL_MACHINE, + model.properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("dwwexymz", model.properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T21:29:39Z"), + model.properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-04T09:47:37Z"), + model.properties().migration().jobs().get(0).endTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerDatabaseUpdate model = new SqlServerDatabaseUpdate().withTags(mapOf("unwqr", "joqza")) + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("rg") + .withDatabaseCreationDate(OffsetDateTime.parse("2021-03-07T07:18:21Z")) + .withCompatibilityLevel(1875104769) + .withSizeMB(76.53575004425825D) + .withLogFileSizeMB(6.536424149627907D) + .withDataFileSizeMB(90.61409980474623D) + .withSpaceAvailableMB(86.74818091970705D) + .withState(DatabaseState.OFFLINE) + .withIsReadOnly(true) + .withRecoveryMode(RecoveryMode.SIMPLE) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(false) + .withIsAutoShrinkOn(false) + .withIsAutoCreateStatsOn(false) + .withIsAutoUpdateStatsOn(false) + .withIsRemoteDataArchiveEnabled(false) + .withIsMemoryOptimizationEnabled(false) + .withIsEncrypted(true) + .withIsTrustworthyOn(false) + .withIsHekatonFilesOn(false) + .withNumberOfHekatonFiles(34796750)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2021-07-26T11:57:58Z")) + .withLastLogBackup(OffsetDateTime.parse("2020-12-23T03:02:40Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(1064315343) + .withFullBackupDays(1892666564) + .withDifferentialBackupHours(DifferentialBackupHours.TWELVE) + .withTransactionLogBackupMinutes(1794200492)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId("yunssx") + .withRestorePointInTime(OffsetDateTime.parse("2021-07-11T09:36:08Z")) + .withMigration(new DataBaseMigration().withAssessment(new DataBaseMigrationAssessment()) + .withJobs(Arrays.asList( + new DatabaseMigrationJobsItem().withMigrationTrackingId("rpcjttbstvjeaqnr") + .withMigrationMode(MigrationMode.OTHER) + .withInitiatedFrom(InitiatedFrom.DMSPORTAL) + .withStatus(MigrationStatus.IN_PROGRESS) + .withLastError("lghktuidvrm") + .withTargetType(TargetType.AZURE_SQL_VIRTUAL_MACHINE) + .withTargetResourceId("dwwexymz") + .withStartTime(OffsetDateTime.parse("2021-08-09T21:29:39Z")) + .withEndTime(OffsetDateTime.parse("2021-01-04T09:47:37Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes(), new AdditionalMigrationJobAttributes())), + new DatabaseMigrationJobsItem().withMigrationTrackingId("pwvqsgnyyu") + .withMigrationMode(MigrationMode.MILINK) + .withInitiatedFrom(InitiatedFrom.SSMA) + .withStatus(MigrationStatus.IN_PROGRESS_WITH_WARNINGS) + .withLastError("pmeyyvpkpatlbijp") + .withTargetType(TargetType.AZURE_SQL_MANAGED_INSTANCE) + .withTargetResourceId("srfhf") + .withStartTime(OffsetDateTime.parse("2021-05-25T20:54:06Z")) + .withEndTime(OffsetDateTime.parse("2021-01-30T11:52:58Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes())), + new DatabaseMigrationJobsItem().withMigrationTrackingId("xwcdomm") + .withMigrationMode(MigrationMode.LOG_SHIPPING) + .withInitiatedFrom(InitiatedFrom.DMSPORTAL) + .withStatus(MigrationStatus.SUCCESSFUL) + .withLastError("gbrt") + .withTargetType(TargetType.AZURE_SQL_MANAGED_INSTANCE) + .withTargetResourceId("clkiexhajl") + .withStartTime(OffsetDateTime.parse("2021-09-28T09:45:01Z")) + .withEndTime(OffsetDateTime.parse("2021-10-01T04:07:55Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes())), + new DatabaseMigrationJobsItem().withMigrationTrackingId("uttdiygbp") + .withMigrationMode(MigrationMode.LOG_SHIPPING) + .withInitiatedFrom(InitiatedFrom.AZURE_ARC) + .withStatus(MigrationStatus.SUCCESSFUL) + .withLastError("k") + .withTargetType(TargetType.AZURE_SQL_DATABASE) + .withTargetResourceId("wgzwxjlmecvog") + .withStartTime(OffsetDateTime.parse("2021-10-25T06:31:18Z")) + .withEndTime(OffsetDateTime.parse("2021-07-17T14:20:46Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes(), new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes())))))); + model = BinaryData.fromObject(model).toObject(SqlServerDatabaseUpdate.class); + Assertions.assertEquals("joqza", model.tags().get("unwqr")); + Assertions.assertEquals("rg", model.properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-07T07:18:21Z"), + model.properties().databaseCreationDate()); + Assertions.assertEquals(1875104769, model.properties().compatibilityLevel()); + Assertions.assertEquals(76.53575004425825D, model.properties().sizeMB()); + Assertions.assertEquals(6.536424149627907D, model.properties().logFileSizeMB()); + Assertions.assertEquals(90.61409980474623D, model.properties().dataFileSizeMB()); + Assertions.assertEquals(86.74818091970705D, model.properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.OFFLINE, model.properties().state()); + Assertions.assertTrue(model.properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.SIMPLE, model.properties().recoveryMode()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoCloseOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertFalse(model.properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertFalse(model.properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertFalse(model.properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertTrue(model.properties().databaseOptions().isEncrypted()); + Assertions.assertFalse(model.properties().databaseOptions().isTrustworthyOn()); + Assertions.assertFalse(model.properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(34796750, model.properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-26T11:57:58Z"), + model.properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T03:02:40Z"), + model.properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(1064315343, model.properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(1892666564, model.properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWELVE, + model.properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(1794200492, model.properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.POINT_IN_TIME_RESTORE, model.properties().createMode()); + Assertions.assertEquals("yunssx", model.properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-11T09:36:08Z"), model.properties().restorePointInTime()); + Assertions.assertEquals("rpcjttbstvjeaqnr", model.properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.OTHER, model.properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.DMSPORTAL, model.properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.IN_PROGRESS, model.properties().migration().jobs().get(0).status()); + Assertions.assertEquals("lghktuidvrm", model.properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_VIRTUAL_MACHINE, + model.properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("dwwexymz", model.properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T21:29:39Z"), + model.properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-04T09:47:37Z"), + model.properties().migration().jobs().get(0).endTime()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateWithResponseMockTests.java new file mode 100644 index 000000000000..3e1e0c9a06a2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesCreateWithResponseMockTests.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.AdditionalMigrationJobAttributes; +import com.azure.resourcemanager.azurearcdata.models.BackupPolicy; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigration; +import com.azure.resourcemanager.azurearcdata.models.DataBaseMigrationAssessment; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseMigrationJobsItem; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.MigrationStatus; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourceProperties; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerDatabasesCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"collationName\":\"qmawzjdrpizfu\",\"databaseCreationDate\":\"2021-11-04T23:11:12Z\",\"compatibilityLevel\":1335462444,\"sizeMB\":52.25575674887805,\"logFileSizeMB\":42.58680320876722,\"dataFileSizeMB\":66.01519800047238,\"spaceAvailableMB\":41.048339966640704,\"state\":\"Online\",\"isReadOnly\":true,\"recoveryMode\":\"Full\",\"databaseOptions\":{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":false,\"isAutoCreateStatsOn\":true,\"isAutoUpdateStatsOn\":true,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":true,\"isEncrypted\":true,\"isTrustworthyOn\":true,\"isHekatonFilesOn\":false,\"numberOfHekatonFiles\":1887429499},\"backupInformation\":{\"lastFullBackup\":\"2021-01-29T10:10:59Z\",\"lastLogBackup\":\"2021-07-30T17:06Z\"},\"backupPolicy\":{\"retentionPeriodDays\":1690500936,\"fullBackupDays\":651513077,\"differentialBackupHours\":24,\"transactionLogBackupMinutes\":1798129537},\"earliestRestoreDate\":\"2021-03-06T11:14:51Z\",\"createMode\":\"Default\",\"sourceDatabaseId\":\"jmeqkvy\",\"vmId\":\"okpoyuoh\",\"restorePointInTime\":\"2021-07-03T07:01:32Z\",\"provisioningState\":\"na\",\"lastDatabaseUploadTime\":\"2021-05-03T05:04:17Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-08-11T05:19Z\",\"targetRecommendationGenerationTime\":\"2021-09-06T09:01:37Z\",\"databaseAssessments\":[{},{},{}],\"targetReadiness\":{\"azureSqlDatabase\":{},\"azureSqlManagedInstance\":{},\"azureSqlVirtualMachine\":{}}},\"jobs\":[{\"migrationTrackingId\":\"jsumxpezcoio\",\"migrationMode\":\"Unknown\",\"initiatedFrom\":\"SSMS\",\"status\":\"InProgressWithWarnings\",\"lastError\":\"qdnxkeedcnw\",\"targetType\":\"AzureSqlDatabase\",\"targetResourceId\":\"fqzkvemyzdpc\",\"startTime\":\"2021-08-31T21:01Z\",\"endTime\":\"2021-02-12T00:02:11Z\",\"additionalAttributes\":[{},{}]}]}},\"location\":\"bmptrwtxzu\",\"tags\":{\"qjghrmthsplwst\":\"monatnizexroq\",\"ceov\":\"xsrgxfqpan\",\"s\":\"gzwhsxyrujmtik\"},\"id\":\"ik\",\"name\":\"ohzixyqhfnkvycqq\",\"type\":\"dseipnquwzxhrp\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerDatabaseResource response = manager.sqlServerDatabases() + .define("vzske") + .withRegion("zpzwegh") + .withExistingSqlServerInstance("zezbzu", "udl") + .withProperties(new SqlServerDatabaseResourceProperties().withCollationName("gwfsgqkstyecupyu") + .withDatabaseCreationDate(OffsetDateTime.parse("2021-06-13T17:59:49Z")) + .withCompatibilityLevel(1645504200) + .withSizeMB(76.91486641770908D) + .withLogFileSizeMB(63.34469920355278D) + .withDataFileSizeMB(84.8074458974894D) + .withSpaceAvailableMB(28.264101642006313D) + .withState(DatabaseState.OFFLINE) + .withIsReadOnly(false) + .withRecoveryMode(RecoveryMode.FULL) + .withDatabaseOptions(new SqlServerDatabaseResourcePropertiesDatabaseOptions().withIsAutoCloseOn(false) + .withIsAutoShrinkOn(false) + .withIsAutoCreateStatsOn(true) + .withIsAutoUpdateStatsOn(true) + .withIsRemoteDataArchiveEnabled(false) + .withIsMemoryOptimizationEnabled(true) + .withIsEncrypted(true) + .withIsTrustworthyOn(false) + .withIsHekatonFilesOn(false) + .withNumberOfHekatonFiles(1546981752)) + .withBackupInformation(new SqlServerDatabaseResourcePropertiesBackupInformation() + .withLastFullBackup(OffsetDateTime.parse("2021-08-24T02:35:13Z")) + .withLastLogBackup(OffsetDateTime.parse("2021-07-30T05:45:07Z"))) + .withBackupPolicy(new BackupPolicy().withRetentionPeriodDays(363769307) + .withFullBackupDays(443998305) + .withDifferentialBackupHours(DifferentialBackupHours.TWELVE) + .withTransactionLogBackupMinutes(1271586809)) + .withCreateMode(DatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId("zidgzwd") + .withRestorePointInTime(OffsetDateTime.parse("2021-03-26T14:45:23Z")) + .withMigration(new DataBaseMigration().withAssessment(new DataBaseMigrationAssessment()) + .withJobs(Arrays.asList(new DatabaseMigrationJobsItem().withMigrationTrackingId("ykd") + .withMigrationMode(MigrationMode.LOG_SHIPPING) + .withInitiatedFrom(InitiatedFrom.ADS) + .withStatus(MigrationStatus.FAILED) + .withLastError("drcoanv") + .withTargetType(TargetType.AZURE_SQL_VIRTUAL_MACHINE) + .withTargetResourceId("xonckbnlblfxlup") + .withStartTime(OffsetDateTime.parse("2021-05-04T05:07:49Z")) + .withEndTime(OffsetDateTime.parse("2020-12-21T07:32:54Z")) + .withAdditionalAttributes(Arrays.asList(new AdditionalMigrationJobAttributes(), + new AdditionalMigrationJobAttributes(), new AdditionalMigrationJobAttributes())))))) + .withTags(mapOf("dve", "bogvgfklqiy", "trkzxsgtznsvlrds", "elsbfvd", "pimyndnoxax", "o")) + .create(); + + Assertions.assertEquals("bmptrwtxzu", response.location()); + Assertions.assertEquals("monatnizexroq", response.tags().get("qjghrmthsplwst")); + Assertions.assertEquals("qmawzjdrpizfu", response.properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T23:11:12Z"), + response.properties().databaseCreationDate()); + Assertions.assertEquals(1335462444, response.properties().compatibilityLevel()); + Assertions.assertEquals(52.25575674887805D, response.properties().sizeMB()); + Assertions.assertEquals(42.58680320876722D, response.properties().logFileSizeMB()); + Assertions.assertEquals(66.01519800047238D, response.properties().dataFileSizeMB()); + Assertions.assertEquals(41.048339966640704D, response.properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.ONLINE, response.properties().state()); + Assertions.assertTrue(response.properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.FULL, response.properties().recoveryMode()); + Assertions.assertFalse(response.properties().databaseOptions().isAutoCloseOn()); + Assertions.assertFalse(response.properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertTrue(response.properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertTrue(response.properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertFalse(response.properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertTrue(response.properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertTrue(response.properties().databaseOptions().isEncrypted()); + Assertions.assertTrue(response.properties().databaseOptions().isTrustworthyOn()); + Assertions.assertFalse(response.properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(1887429499, response.properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-29T10:10:59Z"), + response.properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-30T17:06Z"), + response.properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(1690500936, response.properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(651513077, response.properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWENTY_FOUR, + response.properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(1798129537, response.properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.DEFAULT, response.properties().createMode()); + Assertions.assertEquals("jmeqkvy", response.properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T07:01:32Z"), + response.properties().restorePointInTime()); + Assertions.assertEquals("jsumxpezcoio", response.properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.UNKNOWN, response.properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.SSMS, response.properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.IN_PROGRESS_WITH_WARNINGS, + response.properties().migration().jobs().get(0).status()); + Assertions.assertEquals("qdnxkeedcnw", response.properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_DATABASE, + response.properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("fqzkvemyzdpc", response.properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-31T21:01Z"), + response.properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-12T00:02:11Z"), + response.properties().migration().jobs().get(0).endTime()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetWithResponseMockTests.java new file mode 100644 index 000000000000..0aefbce1e717 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesGetWithResponseMockTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.MigrationStatus; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerDatabasesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"collationName\":\"ti\",\"databaseCreationDate\":\"2021-05-28T05:46:21Z\",\"compatibilityLevel\":1081448081,\"sizeMB\":87.76066188198676,\"logFileSizeMB\":72.39528514290805,\"dataFileSizeMB\":59.01473401251462,\"spaceAvailableMB\":99.65499227892441,\"state\":\"OfflineSecondary\",\"isReadOnly\":true,\"recoveryMode\":\"Simple\",\"databaseOptions\":{\"isAutoCloseOn\":false,\"isAutoShrinkOn\":true,\"isAutoCreateStatsOn\":false,\"isAutoUpdateStatsOn\":true,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":false,\"isEncrypted\":true,\"isTrustworthyOn\":true,\"isHekatonFilesOn\":true,\"numberOfHekatonFiles\":1455846424},\"backupInformation\":{\"lastFullBackup\":\"2021-05-18T11:49:18Z\",\"lastLogBackup\":\"2021-07-02T14:04:01Z\"},\"backupPolicy\":{\"retentionPeriodDays\":1784140547,\"fullBackupDays\":169513546,\"differentialBackupHours\":12,\"transactionLogBackupMinutes\":1590137198},\"earliestRestoreDate\":\"2021-10-16T16:31:32Z\",\"createMode\":\"PointInTimeRestore\",\"sourceDatabaseId\":\"k\",\"vmId\":\"zkdtzxsoed\",\"restorePointInTime\":\"2021-10-07T08:42:59Z\",\"provisioningState\":\"li\",\"lastDatabaseUploadTime\":\"2021-09-15T08:03:44Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2021-01-23T23:31:54Z\",\"targetRecommendationGenerationTime\":\"2021-02-14T08:25:08Z\",\"databaseAssessments\":[{},{},{},{}],\"targetReadiness\":{\"azureSqlDatabase\":{},\"azureSqlManagedInstance\":{},\"azureSqlVirtualMachine\":{}}},\"jobs\":[{\"migrationTrackingId\":\"bzdrdpuenxkgt\",\"migrationMode\":\"LogShipping\",\"initiatedFrom\":\"Other\",\"status\":\"Successful\",\"lastError\":\"cznnhzkbn\",\"targetType\":\"AzureSqlVirtualMachine\",\"targetResourceId\":\"xmwtygeqzu\",\"startTime\":\"2021-01-09T06:13:52Z\",\"endTime\":\"2021-04-07T13:32:38Z\",\"additionalAttributes\":[{},{}]},{\"migrationTrackingId\":\"fsgbjmlreesrf\",\"migrationMode\":\"Other\",\"initiatedFrom\":\"ADS\",\"status\":\"InProgressWithWarnings\",\"lastError\":\"lisolntfxxc\",\"targetType\":\"AzureSqlDatabase\",\"targetResourceId\":\"pfjwfo\",\"startTime\":\"2021-11-10T06:22:54Z\",\"endTime\":\"2021-05-12T22:24:07Z\",\"additionalAttributes\":[{},{}]},{\"migrationTrackingId\":\"xbaizab\",\"migrationMode\":\"LogShipping\",\"initiatedFrom\":\"Other\",\"status\":\"Successful\",\"lastError\":\"toxjdzj\",\"targetType\":\"AzureSqlVirtualMachine\",\"targetResourceId\":\"vhxqqmqipaydhfnz\",\"startTime\":\"2021-11-01T07:45:08Z\",\"endTime\":\"2021-03-19T08:53:28Z\",\"additionalAttributes\":[{},{}]},{\"migrationTrackingId\":\"k\",\"migrationMode\":\"Unknown\",\"initiatedFrom\":\"Other\",\"status\":\"InProgress\",\"lastError\":\"mwbwmbnlslce\",\"targetType\":\"AzureSqlVirtualMachine\",\"targetResourceId\":\"ktwtk\",\"startTime\":\"2021-06-01T06:22:12Z\",\"endTime\":\"2021-02-22T08:32:35Z\",\"additionalAttributes\":[{},{}]}]}},\"location\":\"woynguu\",\"tags\":{\"sybkekymffzt\":\"vladpcmhjha\",\"syeiih\":\"ilscv\",\"eseuugci\":\"ymkouih\"},\"id\":\"zhogsmgbvmtdw\",\"name\":\"qbe\",\"type\":\"jnfveg\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerDatabaseResource response = manager.sqlServerDatabases() + .getWithResponse("mkctdhuo", "gwqpsqazih", "odvqgcnbhcbmj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("woynguu", response.location()); + Assertions.assertEquals("vladpcmhjha", response.tags().get("sybkekymffzt")); + Assertions.assertEquals("ti", response.properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T05:46:21Z"), + response.properties().databaseCreationDate()); + Assertions.assertEquals(1081448081, response.properties().compatibilityLevel()); + Assertions.assertEquals(87.76066188198676D, response.properties().sizeMB()); + Assertions.assertEquals(72.39528514290805D, response.properties().logFileSizeMB()); + Assertions.assertEquals(59.01473401251462D, response.properties().dataFileSizeMB()); + Assertions.assertEquals(99.65499227892441D, response.properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.OFFLINE_SECONDARY, response.properties().state()); + Assertions.assertTrue(response.properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.SIMPLE, response.properties().recoveryMode()); + Assertions.assertFalse(response.properties().databaseOptions().isAutoCloseOn()); + Assertions.assertTrue(response.properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertFalse(response.properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertTrue(response.properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertFalse(response.properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertFalse(response.properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertTrue(response.properties().databaseOptions().isEncrypted()); + Assertions.assertTrue(response.properties().databaseOptions().isTrustworthyOn()); + Assertions.assertTrue(response.properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(1455846424, response.properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T11:49:18Z"), + response.properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-02T14:04:01Z"), + response.properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(1784140547, response.properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(169513546, response.properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWELVE, + response.properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(1590137198, response.properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.POINT_IN_TIME_RESTORE, response.properties().createMode()); + Assertions.assertEquals("k", response.properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-07T08:42:59Z"), + response.properties().restorePointInTime()); + Assertions.assertEquals("bzdrdpuenxkgt", response.properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.LOG_SHIPPING, + response.properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.OTHER, response.properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.SUCCESSFUL, response.properties().migration().jobs().get(0).status()); + Assertions.assertEquals("cznnhzkbn", response.properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_VIRTUAL_MACHINE, + response.properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("xmwtygeqzu", response.properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-09T06:13:52Z"), + response.properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-07T13:32:38Z"), + response.properties().migration().jobs().get(0).endTime()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListMockTests.java new file mode 100644 index 000000000000..147e04401cee --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerDatabasesListMockTests.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.DatabaseCreateMode; +import com.azure.resourcemanager.azurearcdata.models.DatabaseState; +import com.azure.resourcemanager.azurearcdata.models.DifferentialBackupHours; +import com.azure.resourcemanager.azurearcdata.models.InitiatedFrom; +import com.azure.resourcemanager.azurearcdata.models.MigrationMode; +import com.azure.resourcemanager.azurearcdata.models.MigrationStatus; +import com.azure.resourcemanager.azurearcdata.models.RecoveryMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerDatabaseResource; +import com.azure.resourcemanager.azurearcdata.models.TargetType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerDatabasesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"collationName\":\"icudyhizpa\",\"databaseCreationDate\":\"2021-10-29T10:25:07Z\",\"compatibilityLevel\":1407014873,\"sizeMB\":97.75222066433231,\"logFileSizeMB\":92.4442846615102,\"dataFileSizeMB\":15.734319870919023,\"spaceAvailableMB\":98.57730119520383,\"state\":\"Suspect\",\"isReadOnly\":true,\"recoveryMode\":\"Full\",\"databaseOptions\":{\"isAutoCloseOn\":true,\"isAutoShrinkOn\":true,\"isAutoCreateStatsOn\":true,\"isAutoUpdateStatsOn\":false,\"isRemoteDataArchiveEnabled\":false,\"isMemoryOptimizationEnabled\":false,\"isEncrypted\":false,\"isTrustworthyOn\":true,\"isHekatonFilesOn\":false,\"numberOfHekatonFiles\":55015018},\"backupInformation\":{\"lastFullBackup\":\"2021-02-12T06:29:17Z\",\"lastLogBackup\":\"2021-11-13T20:06:56Z\"},\"backupPolicy\":{\"retentionPeriodDays\":559967272,\"fullBackupDays\":1766498014,\"differentialBackupHours\":24,\"transactionLogBackupMinutes\":1180951594},\"earliestRestoreDate\":\"2021-06-17T13:03:46Z\",\"createMode\":\"Default\",\"sourceDatabaseId\":\"yoqxdedecfiwhag\",\"vmId\":\"urejqrshzzbg\",\"restorePointInTime\":\"2021-09-21T11:52:37Z\",\"provisioningState\":\"xiqqzjkoxdupna\",\"lastDatabaseUploadTime\":\"2021-10-26T17:15:36Z\",\"migration\":{\"assessment\":{\"assessmentUploadTime\":\"2020-12-21T07:29:14Z\",\"targetRecommendationGenerationTime\":\"2021-02-17T14:57:34Z\",\"databaseAssessments\":[{},{},{},{}],\"targetReadiness\":{\"azureSqlDatabase\":{},\"azureSqlManagedInstance\":{},\"azureSqlVirtualMachine\":{}}},\"jobs\":[{\"migrationTrackingId\":\"dqqigdydkghpc\",\"migrationMode\":\"Other\",\"initiatedFrom\":\"DMS-CLI\",\"status\":\"Cancelled\",\"lastError\":\"ktyhhmvfxl\",\"targetType\":\"AzureSqlManagedInstance\",\"targetResourceId\":\"jodmkrrwep\",\"startTime\":\"2021-06-18T21:15:48Z\",\"endTime\":\"2021-03-30T09:10:30Z\",\"additionalAttributes\":[{},{}]},{\"migrationTrackingId\":\"ujqgi\",\"migrationMode\":\"LogShipping\",\"initiatedFrom\":\"DMS-Portal\",\"status\":\"Unknown\",\"lastError\":\"chpqvctsfaeuhww\",\"targetType\":\"AzureSqlDatabase\",\"targetResourceId\":\"tvzuzhasup\",\"startTime\":\"2021-03-02T20:21:11Z\",\"endTime\":\"2021-02-15T03:35:13Z\",\"additionalAttributes\":[{},{},{},{}]}]}},\"location\":\"vzqazvbkarkptg\",\"tags\":{\"gbeq\":\"ruatsyiysjqhen\",\"ysc\":\"gubabyjde\",\"zjemexmnvkvm\":\"ey\",\"dvmip\":\"wrxlniwmcpmrrdlh\"},\"id\":\"beaeq\",\"name\":\"zmhkdclacroczfmu\",\"type\":\"erkeluxzsh\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.sqlServerDatabases().list("abtvkbi", "znhtf", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("vzqazvbkarkptg", response.iterator().next().location()); + Assertions.assertEquals("ruatsyiysjqhen", response.iterator().next().tags().get("gbeq")); + Assertions.assertEquals("icudyhizpa", response.iterator().next().properties().collationName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T10:25:07Z"), + response.iterator().next().properties().databaseCreationDate()); + Assertions.assertEquals(1407014873, response.iterator().next().properties().compatibilityLevel()); + Assertions.assertEquals(97.75222066433231D, response.iterator().next().properties().sizeMB()); + Assertions.assertEquals(92.4442846615102D, response.iterator().next().properties().logFileSizeMB()); + Assertions.assertEquals(15.734319870919023D, response.iterator().next().properties().dataFileSizeMB()); + Assertions.assertEquals(98.57730119520383D, response.iterator().next().properties().spaceAvailableMB()); + Assertions.assertEquals(DatabaseState.SUSPECT, response.iterator().next().properties().state()); + Assertions.assertTrue(response.iterator().next().properties().isReadOnly()); + Assertions.assertEquals(RecoveryMode.FULL, response.iterator().next().properties().recoveryMode()); + Assertions.assertTrue(response.iterator().next().properties().databaseOptions().isAutoCloseOn()); + Assertions.assertTrue(response.iterator().next().properties().databaseOptions().isAutoShrinkOn()); + Assertions.assertTrue(response.iterator().next().properties().databaseOptions().isAutoCreateStatsOn()); + Assertions.assertFalse(response.iterator().next().properties().databaseOptions().isAutoUpdateStatsOn()); + Assertions.assertFalse(response.iterator().next().properties().databaseOptions().isRemoteDataArchiveEnabled()); + Assertions.assertFalse(response.iterator().next().properties().databaseOptions().isMemoryOptimizationEnabled()); + Assertions.assertFalse(response.iterator().next().properties().databaseOptions().isEncrypted()); + Assertions.assertTrue(response.iterator().next().properties().databaseOptions().isTrustworthyOn()); + Assertions.assertFalse(response.iterator().next().properties().databaseOptions().isHekatonFilesOn()); + Assertions.assertEquals(55015018, + response.iterator().next().properties().databaseOptions().numberOfHekatonFiles()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-12T06:29:17Z"), + response.iterator().next().properties().backupInformation().lastFullBackup()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T20:06:56Z"), + response.iterator().next().properties().backupInformation().lastLogBackup()); + Assertions.assertEquals(559967272, + response.iterator().next().properties().backupPolicy().retentionPeriodDays()); + Assertions.assertEquals(1766498014, response.iterator().next().properties().backupPolicy().fullBackupDays()); + Assertions.assertEquals(DifferentialBackupHours.TWENTY_FOUR, + response.iterator().next().properties().backupPolicy().differentialBackupHours()); + Assertions.assertEquals(1180951594, + response.iterator().next().properties().backupPolicy().transactionLogBackupMinutes()); + Assertions.assertEquals(DatabaseCreateMode.DEFAULT, response.iterator().next().properties().createMode()); + Assertions.assertEquals("yoqxdedecfiwhag", response.iterator().next().properties().sourceDatabaseId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-21T11:52:37Z"), + response.iterator().next().properties().restorePointInTime()); + Assertions.assertEquals("dqqigdydkghpc", + response.iterator().next().properties().migration().jobs().get(0).migrationTrackingId()); + Assertions.assertEquals(MigrationMode.OTHER, + response.iterator().next().properties().migration().jobs().get(0).migrationMode()); + Assertions.assertEquals(InitiatedFrom.DMSCLI, + response.iterator().next().properties().migration().jobs().get(0).initiatedFrom()); + Assertions.assertEquals(MigrationStatus.CANCELLED, + response.iterator().next().properties().migration().jobs().get(0).status()); + Assertions.assertEquals("ktyhhmvfxl", + response.iterator().next().properties().migration().jobs().get(0).lastError()); + Assertions.assertEquals(TargetType.AZURE_SQL_MANAGED_INSTANCE, + response.iterator().next().properties().migration().jobs().get(0).targetType()); + Assertions.assertEquals("jodmkrrwep", + response.iterator().next().properties().migration().jobs().get(0).targetResourceId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-18T21:15:48Z"), + response.iterator().next().properties().migration().jobs().get(0).startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-30T09:10:30Z"), + response.iterator().next().properties().migration().jobs().get(0).endTime()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseInnerTests.java new file mode 100644 index 000000000000..32ecd59662cd --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseInnerTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerEsuLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerEsuLicenseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerEsuLicenseInner model = BinaryData.fromString( + "{\"properties\":{\"billingPlan\":\"PAYG\",\"version\":\"SQL Server 2012\",\"uniqueId\":\"mq\",\"physicalCores\":1677650258,\"activationState\":\"Faulted\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2021-03-19T09:23:49Z\",\"terminatedAt\":\"2021-01-19T22:08:38Z\",\"tenantId\":\"nw\"},\"location\":\"cevehjkuyxoafg\",\"tags\":{\"aeylinm\":\"lt\",\"irpghriypoqeyh\":\"gv\"},\"id\":\"qhykprlpyzn\",\"name\":\"ciqdsme\",\"type\":\"iitdfuxt\"}") + .toObject(SqlServerEsuLicenseInner.class); + Assertions.assertEquals("cevehjkuyxoafg", model.location()); + Assertions.assertEquals("lt", model.tags().get("aeylinm")); + Assertions.assertEquals(BillingPlan.PAYG, model.properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2012, model.properties().version()); + Assertions.assertEquals(1677650258, model.properties().physicalCores()); + Assertions.assertEquals(State.FAULTED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.properties().scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerEsuLicenseInner model = new SqlServerEsuLicenseInner().withLocation("cevehjkuyxoafg") + .withTags(mapOf("aeylinm", "lt", "irpghriypoqeyh", "gv")) + .withProperties(new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withVersion(Version.SQLSERVER2012) + .withPhysicalCores(1677650258) + .withActivationState(State.FAULTED) + .withScopeType(ScopeType.RESOURCE_GROUP)); + model = BinaryData.fromObject(model).toObject(SqlServerEsuLicenseInner.class); + Assertions.assertEquals("cevehjkuyxoafg", model.location()); + Assertions.assertEquals("lt", model.tags().get("aeylinm")); + Assertions.assertEquals(BillingPlan.PAYG, model.properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2012, model.properties().version()); + Assertions.assertEquals(1677650258, model.properties().physicalCores()); + Assertions.assertEquals(State.FAULTED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.properties().scopeType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseListResultTests.java new file mode 100644 index 000000000000..6acf0d651a3f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseListResultTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerEsuLicenseListResult; + +public final class SqlServerEsuLicenseListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerEsuLicenseListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2014\",\"uniqueId\":\"hdxbzlm\",\"physicalCores\":868516096,\"activationState\":\"Active\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2021-04-04T03:22:51Z\",\"terminatedAt\":\"2021-08-04T10:09:35Z\",\"tenantId\":\"bevwqqxeys\"},\"location\":\"nqzi\",\"tags\":{\"z\":\"kbg\"},\"id\":\"owxeqocljmy\",\"name\":\"vkzqk\",\"type\":\"jeokbzefezrxccz\"},{\"properties\":{\"billingPlan\":\"PAYG\",\"version\":\"SQL Server 2016\",\"uniqueId\":\"e\",\"physicalCores\":1572244952,\"activationState\":\"Suspended\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2021-11-23T23:12:55Z\",\"terminatedAt\":\"2021-07-20T12:41:28Z\",\"tenantId\":\"gnzvdfbzdixzm\"},\"location\":\"noda\",\"tags\":{\"tmcg\":\"qhewj\"},\"id\":\"bostzel\",\"name\":\"dlat\",\"type\":\"tmzlbiojlv\"},{\"properties\":{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2014\",\"uniqueId\":\"bpneqvcwwyyurm\",\"physicalCores\":996816888,\"activationState\":\"Terminated\",\"scopeType\":\"Tenant\",\"activatedAt\":\"2021-09-05T14:26:35Z\",\"terminatedAt\":\"2021-03-24T07:32:19Z\",\"tenantId\":\"nmokayzejnhlbk\"},\"location\":\"z\",\"tags\":{\"echndbnwieholew\":\"iljhahz\",\"efqsfapaqtferrqw\":\"wiuub\",\"kmfx\":\"x\"},\"id\":\"pjwogqqno\",\"name\":\"pud\",\"type\":\"dabtqwp\"}],\"nextLink\":\"awbzasqb\"}") + .toObject(SqlServerEsuLicenseListResult.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensePropertiesTests.java new file mode 100644 index 000000000000..e209d7f6a95d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensePropertiesTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerEsuLicensePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerEsuLicenseProperties model = BinaryData.fromString( + "{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2012\",\"uniqueId\":\"ibmi\",\"physicalCores\":623637817,\"activationState\":\"Enabled\",\"scopeType\":\"Subscription\",\"activatedAt\":\"2021-03-24T20:59:38Z\",\"terminatedAt\":\"2021-06-12T08:52:33Z\",\"tenantId\":\"ljhnmgixhcmav\"}") + .toObject(SqlServerEsuLicenseProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2012, model.version()); + Assertions.assertEquals(623637817, model.physicalCores()); + Assertions.assertEquals(State.ENABLED, model.activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerEsuLicenseProperties model = new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAID) + .withVersion(Version.SQLSERVER2012) + .withPhysicalCores(623637817) + .withActivationState(State.ENABLED) + .withScopeType(ScopeType.SUBSCRIPTION); + model = BinaryData.fromObject(model).toObject(SqlServerEsuLicenseProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2012, model.version()); + Assertions.assertEquals(623637817, model.physicalCores()); + Assertions.assertEquals(State.ENABLED, model.activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseUpdatePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseUpdatePropertiesTests.java new file mode 100644 index 000000000000..802c301e0668 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseUpdatePropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerEsuLicenseUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerEsuLicenseUpdateProperties model = BinaryData.fromString( + "{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2014\",\"uniqueId\":\"hedsvqwthmkyib\",\"physicalCores\":1374749557,\"activationState\":\"Inactive\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2021-06-23T13:22:14Z\",\"terminatedAt\":\"2021-01-02T11:43:38Z\",\"tenantId\":\"ohsdtmcd\"}") + .toObject(SqlServerEsuLicenseUpdateProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2014, model.version()); + Assertions.assertEquals(1374749557, model.physicalCores()); + Assertions.assertEquals(State.INACTIVE, model.activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerEsuLicenseUpdateProperties model + = new SqlServerEsuLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withVersion(Version.SQLSERVER2014) + .withPhysicalCores(1374749557) + .withActivationState(State.INACTIVE) + .withScopeType(ScopeType.RESOURCE_GROUP); + model = BinaryData.fromObject(model).toObject(SqlServerEsuLicenseUpdateProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2014, model.version()); + Assertions.assertEquals(1374749557, model.physicalCores()); + Assertions.assertEquals(State.INACTIVE, model.activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseUpdateTests.java new file mode 100644 index 000000000000..c7112630ceb9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicenseUpdateTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseUpdateProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerEsuLicenseUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerEsuLicenseUpdate model = BinaryData.fromString( + "{\"tags\":{\"otwypundmb\":\"oudorhcgyyp\",\"cmjkavlgorbmftpm\":\"hu\"},\"properties\":{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2014\",\"uniqueId\":\"fvnz\",\"physicalCores\":927158776,\"activationState\":\"Disabled\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2021-04-08T00:16:43Z\",\"terminatedAt\":\"2021-07-11T15:43:09Z\",\"tenantId\":\"bdb\"}}") + .toObject(SqlServerEsuLicenseUpdate.class); + Assertions.assertEquals("oudorhcgyyp", model.tags().get("otwypundmb")); + Assertions.assertEquals(BillingPlan.PAID, model.properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2014, model.properties().version()); + Assertions.assertEquals(927158776, model.properties().physicalCores()); + Assertions.assertEquals(State.DISABLED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.properties().scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerEsuLicenseUpdate model + = new SqlServerEsuLicenseUpdate().withTags(mapOf("otwypundmb", "oudorhcgyyp", "cmjkavlgorbmftpm", "hu")) + .withProperties(new SqlServerEsuLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withVersion(Version.SQLSERVER2014) + .withPhysicalCores(927158776) + .withActivationState(State.DISABLED) + .withScopeType(ScopeType.RESOURCE_GROUP)); + model = BinaryData.fromObject(model).toObject(SqlServerEsuLicenseUpdate.class); + Assertions.assertEquals("oudorhcgyyp", model.tags().get("otwypundmb")); + Assertions.assertEquals(BillingPlan.PAID, model.properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2014, model.properties().version()); + Assertions.assertEquals(927158776, model.properties().physicalCores()); + Assertions.assertEquals(State.DISABLED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.properties().scopeType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateWithResponseMockTests.java new file mode 100644 index 000000000000..f6d566fa7b61 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesCreateWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicenseProperties; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerEsuLicensesCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2016\",\"uniqueId\":\"kwabsolronqq\",\"physicalCores\":1025087283,\"activationState\":\"Active\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2021-08-25T18:21:47Z\",\"terminatedAt\":\"2021-02-08T02:13:29Z\",\"tenantId\":\"xtelexhvu\"},\"location\":\"ozoolzq\",\"tags\":{\"bc\":\"rkuz\",\"dyz\":\"ndtsnxawqytll\"},\"id\":\"yckzex\",\"name\":\"xak\",\"type\":\"kywymxgaabj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerEsuLicense response = manager.sqlServerEsuLicenses() + .define("dvwnjkgvfnmxa") + .withRegion("xvucnul") + .withExistingResourceGroup("pnx") + .withProperties(new SqlServerEsuLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withVersion(Version.SQLSERVER2014) + .withPhysicalCores(989541715) + .withActivationState(State.INACTIVE) + .withScopeType(ScopeType.RESOURCE_GROUP)) + .withTags(mapOf("znfaj", "hjevd")) + .create(); + + Assertions.assertEquals("ozoolzq", response.location()); + Assertions.assertEquals("rkuz", response.tags().get("bc")); + Assertions.assertEquals(BillingPlan.PAID, response.properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2016, response.properties().version()); + Assertions.assertEquals(1025087283, response.properties().physicalCores()); + Assertions.assertEquals(State.ACTIVE, response.properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, response.properties().scopeType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteByResourceGroupWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..b7a5faa99eff --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerEsuLicensesDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.sqlServerEsuLicenses() + .deleteByResourceGroupWithResponse("yeofltfnnxrkad", "fynn", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..7f7fd0a2ed6c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerEsuLicensesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"billingPlan\":\"PAYG\",\"version\":\"SQL Server 2012\",\"uniqueId\":\"yznclkfkee\",\"physicalCores\":279421379,\"activationState\":\"Suspended\",\"scopeType\":\"Tenant\",\"activatedAt\":\"2021-08-08T01:44:43Z\",\"terminatedAt\":\"2021-10-07T20:58:36Z\",\"tenantId\":\"oqujlyegqavn\"},\"location\":\"flqqbtnyjpylxd\",\"tags\":{\"kottlwuhvajmailf\":\"abmvmsxbaevwjc\"},\"id\":\"mjjz\",\"name\":\"kzwjiqullq\",\"type\":\"bdmvrscmqerndbr\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerEsuLicense response = manager.sqlServerEsuLicenses() + .getByResourceGroupWithResponse("shxgonoy", "fq", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("flqqbtnyjpylxd", response.location()); + Assertions.assertEquals("abmvmsxbaevwjc", response.tags().get("kottlwuhvajmailf")); + Assertions.assertEquals(BillingPlan.PAYG, response.properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2012, response.properties().version()); + Assertions.assertEquals(279421379, response.properties().physicalCores()); + Assertions.assertEquals(State.SUSPENDED, response.properties().activationState()); + Assertions.assertEquals(ScopeType.TENANT, response.properties().scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupMockTests.java new file mode 100644 index 000000000000..f1ab2fe9b532 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListByResourceGroupMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerEsuLicensesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"billingPlan\":\"PAYG\",\"version\":\"SQL Server 2014\",\"uniqueId\":\"fohyk\",\"physicalCores\":1863566887,\"activationState\":\"Faulted\",\"scopeType\":\"Subscription\",\"activatedAt\":\"2021-09-28T09:28:55Z\",\"terminatedAt\":\"2021-04-13T12:16:17Z\",\"tenantId\":\"jiutgnjizbe\"},\"location\":\"oiymrvzbjuyrsrzi\",\"tags\":{\"apezkiswqjmdghs\":\"ixgbdsuifrevk\",\"jczjnciuiyqv\":\"parybjufpt\"},\"id\":\"daswvpp\",\"name\":\"sqqzlgcndhz\",\"type\":\"rr\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.sqlServerEsuLicenses().listByResourceGroup("muii", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("oiymrvzbjuyrsrzi", response.iterator().next().location()); + Assertions.assertEquals("ixgbdsuifrevk", response.iterator().next().tags().get("apezkiswqjmdghs")); + Assertions.assertEquals(BillingPlan.PAYG, response.iterator().next().properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2014, response.iterator().next().properties().version()); + Assertions.assertEquals(1863566887, response.iterator().next().properties().physicalCores()); + Assertions.assertEquals(State.FAULTED, response.iterator().next().properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, response.iterator().next().properties().scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListMockTests.java new file mode 100644 index 000000000000..d72bfebf4294 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerEsuLicensesListMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerEsuLicense; +import com.azure.resourcemanager.azurearcdata.models.State; +import com.azure.resourcemanager.azurearcdata.models.Version; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerEsuLicensesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"billingPlan\":\"Paid\",\"version\":\"SQL Server 2014\",\"uniqueId\":\"r\",\"physicalCores\":2141593626,\"activationState\":\"Active\",\"scopeType\":\"ResourceGroup\",\"activatedAt\":\"2020-12-30T14:34:20Z\",\"terminatedAt\":\"2021-01-09T18:06:31Z\",\"tenantId\":\"wkpphefsb\"},\"location\":\"lbzxomeikjc\",\"tags\":{\"qbxyxoyfpuqqi\":\"acnmwpfsuqtaaz\"},\"id\":\"ezxlhdjzqdca\",\"name\":\"wvpsoz\",\"type\":\"iihjriybmrzo\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.sqlServerEsuLicenses().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("lbzxomeikjc", response.iterator().next().location()); + Assertions.assertEquals("acnmwpfsuqtaaz", response.iterator().next().tags().get("qbxyxoyfpuqqi")); + Assertions.assertEquals(BillingPlan.PAID, response.iterator().next().properties().billingPlan()); + Assertions.assertEquals(Version.SQLSERVER2014, response.iterator().next().properties().version()); + Assertions.assertEquals(2141593626, response.iterator().next().properties().physicalCores()); + Assertions.assertEquals(State.ACTIVE, response.iterator().next().properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, response.iterator().next().properties().scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceBpaColumnTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceBpaColumnTests.java new file mode 100644 index 000000000000..c58457818617 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceBpaColumnTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaColumn; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaColumnType; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceBpaColumnTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceBpaColumn model + = BinaryData.fromString("{\"name\":\"gj\",\"type\":\"long\"}").toObject(SqlServerInstanceBpaColumn.class); + Assertions.assertEquals("gj", model.name()); + Assertions.assertEquals(SqlServerInstanceBpaColumnType.LONG, model.type()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceBpaResponseTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceBpaResponseTests.java new file mode 100644 index 000000000000..626f042efd52 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceBpaResponseTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceBpaResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceBpaColumnType; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceBpaResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceBpaResponse model = BinaryData.fromString( + "{\"columns\":[{\"name\":\"beyvpnqicvinvkjj\",\"type\":\"string\"}],\"rows\":[[\"uukzclewyhmlw\",\"aztz\",\"ofncckwyfzqwhxxb\",\"yq\"],[\"zfeqztppri\"],[\"xorjaltolmncwsob\",\"wcsdbnwdcfhucq\",\"pfuvglsbjjca\",\"vxb\"],[\"vudutncor\"]],\"nextLink\":\"lxqtvcofudfl\"}") + .toObject(SqlServerInstanceBpaResponse.class); + Assertions.assertEquals("beyvpnqicvinvkjj", model.columns().get(0).name()); + Assertions.assertEquals(SqlServerInstanceBpaColumnType.STRING, model.columns().get(0).type()); + Assertions.assertEquals("uukzclewyhmlw", model.rows().get(0).get(0)); + Assertions.assertEquals("lxqtvcofudfl", model.nextLink()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java deleted file mode 100644 index a881a32924d6..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceInnerTests.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceInner; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlServerInstanceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceInner model = BinaryData.fromString( - "{\"properties\":{\"version\":\"SQL Server 2016\",\"edition\":\"Web\",\"containerResourceId\":\"phywpnvj\",\"createTime\":\"qnermclfplphoxu\",\"vCore\":\"rpabg\",\"status\":\"Connected\",\"patchLevel\":\"sbj\",\"collation\":\"zq\",\"currentVersion\":\"xywpmueefjzwfqkq\",\"instanceName\":\"ids\",\"tcpDynamicPorts\":\"onobglaocqx\",\"tcpStaticPorts\":\"cmgyud\",\"productId\":\"tlmoyrx\",\"licenseType\":\"Free\",\"azureDefenderStatusLastUpdated\":\"2021-07-05T08:36:14Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"ntxhdzhlrqjbhck\"},\"location\":\"lhrxsbkyvpyc\",\"tags\":{\"p\":\"z\",\"hhseyv\":\"kafkuwbcrnwbm\",\"tslhspkdeem\":\"us\"},\"id\":\"ofmxagkvtmelmqkr\",\"name\":\"ahvljuaha\",\"type\":\"uhcdhm\"}") - .toObject(SqlServerInstanceInner.class); - Assertions.assertEquals("lhrxsbkyvpyc", model.location()); - Assertions.assertEquals("z", model.tags().get("p")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2016, model.properties().version()); - Assertions.assertEquals(EditionType.WEB, model.properties().edition()); - Assertions.assertEquals("phywpnvj", model.properties().containerResourceId()); - Assertions.assertEquals("rpabg", model.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, model.properties().status()); - Assertions.assertEquals("sbj", model.properties().patchLevel()); - Assertions.assertEquals("zq", model.properties().collation()); - Assertions.assertEquals("xywpmueefjzwfqkq", model.properties().currentVersion()); - Assertions.assertEquals("ids", model.properties().instanceName()); - Assertions.assertEquals("onobglaocqx", model.properties().tcpDynamicPorts()); - Assertions.assertEquals("cmgyud", model.properties().tcpStaticPorts()); - Assertions.assertEquals("tlmoyrx", model.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.FREE, model.properties().licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-05T08:36:14Z"), - model.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNPROTECTED, model.properties().azureDefenderStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceInner model = new SqlServerInstanceInner().withLocation("lhrxsbkyvpyc") - .withTags(mapOf("p", "z", "hhseyv", "kafkuwbcrnwbm", "tslhspkdeem", "us")) - .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2016) - .withEdition(EditionType.WEB) - .withContainerResourceId("phywpnvj") - .withVCore("rpabg") - .withStatus(ConnectionStatus.CONNECTED) - .withPatchLevel("sbj") - .withCollation("zq") - .withCurrentVersion("xywpmueefjzwfqkq") - .withInstanceName("ids") - .withTcpDynamicPorts("onobglaocqx") - .withTcpStaticPorts("cmgyud") - .withProductId("tlmoyrx") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-07-05T08:36:14Z")) - .withAzureDefenderStatus(DefenderStatus.UNPROTECTED)); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceInner.class); - Assertions.assertEquals("lhrxsbkyvpyc", model.location()); - Assertions.assertEquals("z", model.tags().get("p")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2016, model.properties().version()); - Assertions.assertEquals(EditionType.WEB, model.properties().edition()); - Assertions.assertEquals("phywpnvj", model.properties().containerResourceId()); - Assertions.assertEquals("rpabg", model.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, model.properties().status()); - Assertions.assertEquals("sbj", model.properties().patchLevel()); - Assertions.assertEquals("zq", model.properties().collation()); - Assertions.assertEquals("xywpmueefjzwfqkq", model.properties().currentVersion()); - Assertions.assertEquals("ids", model.properties().instanceName()); - Assertions.assertEquals("onobglaocqx", model.properties().tcpDynamicPorts()); - Assertions.assertEquals("cmgyud", model.properties().tcpStaticPorts()); - Assertions.assertEquals("tlmoyrx", model.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.FREE, model.properties().licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-05T08:36:14Z"), - model.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNPROTECTED, model.properties().azureDefenderStatus()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobStatusTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobStatusTests.java new file mode 100644 index 000000000000..6778b23a7650 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobStatusTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobStatus; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceJobStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceJobStatus model = BinaryData.fromString( + "{\"id\":\"pzimejzanlfzxi\",\"instanceName\":\"rmbzo\",\"jobStatus\":\"InProgress\",\"jobException\":\"xrjqcirgzpfrlazs\",\"backgroundJob\":{\"state\":\"Inactive\",\"executionState\":\"Waiting\",\"startTime\":\"2020-12-28T18:13:42Z\",\"endTime\":\"2021-10-21T00:35:55Z\",\"lastExecutionStatus\":\"Rescheduled\",\"lastExecutionTime\":\"2021-03-08T14:36:47Z\",\"nextExecutionTime\":\"2021-05-13T14:32:14Z\"},\"sequencerActions\":[{\"actionId\":\"lhflsjcdhszfjvf\",\"state\":\"CreatingSuccessors\",\"result\":\"TimedOut\"}]}") + .toObject(SqlServerInstanceJobStatus.class); + Assertions.assertEquals("pzimejzanlfzxi", model.id()); + Assertions.assertEquals("rmbzo", model.instanceName()); + Assertions.assertEquals(JobStatus.IN_PROGRESS, model.jobStatus()); + Assertions.assertEquals("xrjqcirgzpfrlazs", model.jobException()); + Assertions.assertEquals(State.INACTIVE, model.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, model.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-28T18:13:42Z"), model.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-21T00:35:55Z"), model.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.RESCHEDULED, model.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-08T14:36:47Z"), + model.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-13T14:32:14Z"), + model.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("lhflsjcdhszfjvf", model.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.CREATING_SUCCESSORS, model.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.TIMED_OUT, model.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobTests.java new file mode 100644 index 000000000000..36c15ad5b0b1 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJob; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceJobTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceJob model = BinaryData.fromString( + "{\"id\":\"lvdnkfx\",\"instanceName\":\"emdwzrmuhapfc\",\"jobStatus\":\"InProgress\",\"jobException\":\"qxqvpsvuoymgc\",\"backgroundJob\":{\"state\":\"Deleted\",\"executionState\":\"Running\",\"startTime\":\"2021-02-10T11:31:27Z\",\"endTime\":\"2021-10-22T17:23:43Z\",\"lastExecutionStatus\":\"Rescheduled\",\"lastExecutionTime\":\"2021-09-10T20:17:43Z\",\"nextExecutionTime\":\"2021-08-31T23:42:04Z\"},\"sequencerActions\":[{\"actionId\":\"wkyhkobopgxe\",\"state\":\"Completed\",\"result\":\"Failed\"},{\"actionId\":\"bqpc\",\"state\":\"Completed\",\"result\":\"Failed\"}]}") + .toObject(SqlServerInstanceJob.class); + Assertions.assertEquals("lvdnkfx", model.id()); + Assertions.assertEquals("emdwzrmuhapfc", model.instanceName()); + Assertions.assertEquals(JobStatus.IN_PROGRESS, model.jobStatus()); + Assertions.assertEquals("qxqvpsvuoymgc", model.jobException()); + Assertions.assertEquals(State.DELETED, model.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.RUNNING, model.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-10T11:31:27Z"), model.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-22T17:23:43Z"), model.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.RESCHEDULED, model.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T20:17:43Z"), + model.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-31T23:42:04Z"), + model.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("wkyhkobopgxe", model.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.COMPLETED, model.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.FAILED, model.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsRequestTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsRequestTests.java new file mode 100644 index 000000000000..fabf84980368 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsRequestTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceJobsRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceJobsRequest model + = BinaryData.fromString("{\"featureName\":\"jagrqmqhldvr\",\"jobType\":\"iojnalghfkvtv\"}") + .toObject(SqlServerInstanceJobsRequest.class); + Assertions.assertEquals("jagrqmqhldvr", model.featureName()); + Assertions.assertEquals("iojnalghfkvtv", model.jobType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerInstanceJobsRequest model + = new SqlServerInstanceJobsRequest().withFeatureName("jagrqmqhldvr").withJobType("iojnalghfkvtv"); + model = BinaryData.fromObject(model).toObject(SqlServerInstanceJobsRequest.class); + Assertions.assertEquals("jagrqmqhldvr", model.featureName()); + Assertions.assertEquals("iojnalghfkvtv", model.jobType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsResponseInnerTests.java new file mode 100644 index 000000000000..6c33653dda50 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsResponseInnerTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsResponseInner; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceJobsResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceJobsResponseInner model = BinaryData.fromString( + "{\"jobs\":[{\"id\":\"owueluqh\",\"instanceName\":\"hhxvrhmzkwpj\",\"jobStatus\":\"Failed\",\"jobException\":\"pughftqsxh\",\"backgroundJob\":{\"state\":\"Suspended\",\"executionState\":\"Running\",\"startTime\":\"2021-05-23T18:59:06Z\",\"endTime\":\"2021-03-24T06:22:09Z\",\"lastExecutionStatus\":\"Completed\",\"lastExecutionTime\":\"2021-02-07T08:06:06Z\",\"nextExecutionTime\":\"2021-10-07T00:58:49Z\"},\"sequencerActions\":[{\"actionId\":\"zdmsyqtfi\",\"state\":\"Completed\",\"result\":\"Failed\"},{\"actionId\":\"z\",\"state\":\"NotStarted\",\"result\":\"Failed\"}]},{\"id\":\"pph\",\"instanceName\":\"zqzudph\",\"jobStatus\":\"NotStarted\",\"jobException\":\"dkfw\",\"backgroundJob\":{\"state\":\"Suspended\",\"executionState\":\"Running\",\"startTime\":\"2021-05-07T03:39:17Z\",\"endTime\":\"2021-11-07T22:35:04Z\",\"lastExecutionStatus\":\"Failed\",\"lastExecutionTime\":\"2021-09-06T04:02:04Z\",\"nextExecutionTime\":\"2021-07-26T04:06:19Z\"},\"sequencerActions\":[{\"actionId\":\"atkzwpcnpw\",\"state\":\"WaitingPredecessors\",\"result\":\"Succeeded\"},{\"actionId\":\"gvvs\",\"state\":\"CreatingSuccessors\",\"result\":\"Failed\"},{\"actionId\":\"uq\",\"state\":\"ExecutingAction\",\"result\":\"TimedOut\"}]}]}") + .toObject(SqlServerInstanceJobsResponseInner.class); + Assertions.assertEquals("owueluqh", model.jobs().get(0).id()); + Assertions.assertEquals("hhxvrhmzkwpj", model.jobs().get(0).instanceName()); + Assertions.assertEquals(JobStatus.FAILED, model.jobs().get(0).jobStatus()); + Assertions.assertEquals("pughftqsxh", model.jobs().get(0).jobException()); + Assertions.assertEquals(State.SUSPENDED, model.jobs().get(0).backgroundJob().state()); + Assertions.assertEquals(ExecutionState.RUNNING, model.jobs().get(0).backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-23T18:59:06Z"), + model.jobs().get(0).backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-24T06:22:09Z"), + model.jobs().get(0).backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.COMPLETED, + model.jobs().get(0).backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-07T08:06:06Z"), + model.jobs().get(0).backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-07T00:58:49Z"), + model.jobs().get(0).backgroundJob().nextExecutionTime()); + Assertions.assertEquals("zdmsyqtfi", model.jobs().get(0).sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.COMPLETED, model.jobs().get(0).sequencerActions().get(0).state()); + Assertions.assertEquals(Result.FAILED, model.jobs().get(0).sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsStatusRequestTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsStatusRequestTests.java new file mode 100644 index 000000000000..2eecfcb3cb4c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsStatusRequestTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceJobsStatusRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceJobsStatusRequest model + = BinaryData.fromString("{\"featureName\":\"byqunyow\",\"jobType\":\"lmdjrkvfgbvfvpdb\"}") + .toObject(SqlServerInstanceJobsStatusRequest.class); + Assertions.assertEquals("byqunyow", model.featureName()); + Assertions.assertEquals("lmdjrkvfgbvfvpdb", model.jobType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerInstanceJobsStatusRequest model + = new SqlServerInstanceJobsStatusRequest().withFeatureName("byqunyow").withJobType("lmdjrkvfgbvfvpdb"); + model = BinaryData.fromObject(model).toObject(SqlServerInstanceJobsStatusRequest.class); + Assertions.assertEquals("byqunyow", model.featureName()); + Assertions.assertEquals("lmdjrkvfgbvfvpdb", model.jobType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsStatusResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsStatusResponseInnerTests.java new file mode 100644 index 000000000000..2ef05caa2056 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceJobsStatusResponseInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceJobsStatusResponseInner; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceJobsStatusResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceJobsStatusResponseInner model = BinaryData.fromString( + "{\"jobsStatus\":[{\"id\":\"izsjqlhkrr\",\"instanceName\":\"deibqip\",\"jobStatus\":\"Failed\",\"jobException\":\"vxndz\",\"backgroundJob\":{\"state\":\"Suspended\",\"executionState\":\"Running\",\"startTime\":\"2021-03-31T16:27:46Z\",\"endTime\":\"2021-06-22T17:17:35Z\",\"lastExecutionStatus\":\"Postponed\",\"lastExecutionTime\":\"2021-07-01T01:08:26Z\",\"nextExecutionTime\":\"2021-03-10T15:11:20Z\"},\"sequencerActions\":[{\"actionId\":\"b\",\"state\":\"WaitingPredecessors\",\"result\":\"TimedOut\"},{\"actionId\":\"fxzsjabibsyst\",\"state\":\"Completed\",\"result\":\"Failed\"}]},{\"id\":\"pvkvpbjxbk\",\"instanceName\":\"zkdvncja\",\"jobStatus\":\"Succeeded\",\"jobException\":\"r\",\"backgroundJob\":{\"state\":\"Terminated\",\"executionState\":\"Waiting\",\"startTime\":\"2021-02-03T01:10:02Z\",\"endTime\":\"2021-04-13T17:20:23Z\",\"lastExecutionStatus\":\"Completed\",\"lastExecutionTime\":\"2021-01-27T21:41:09Z\",\"nextExecutionTime\":\"2021-02-05T20:22:21Z\"},\"sequencerActions\":[{\"actionId\":\"wqlgzrf\",\"state\":\"WaitingPredecessors\",\"result\":\"Skipped\"}]},{\"id\":\"izikayuhq\",\"instanceName\":\"jbsybbqw\",\"jobStatus\":\"NotStarted\",\"jobException\":\"dgmfpgvmpipasl\",\"backgroundJob\":{\"state\":\"Terminated\",\"executionState\":\"Waiting\",\"startTime\":\"2021-09-03T05:44:20Z\",\"endTime\":\"2021-06-11T13:35:50Z\",\"lastExecutionStatus\":\"Succeeded\",\"lastExecutionTime\":\"2021-02-18T02:58:52Z\",\"nextExecutionTime\":\"2021-11-08T23:17:29Z\"},\"sequencerActions\":[{\"actionId\":\"pdrhne\",\"state\":\"NotStarted\",\"result\":\"Skipped\"},{\"actionId\":\"d\",\"state\":\"NotStarted\",\"result\":\"NotCompleted\"},{\"actionId\":\"bi\",\"state\":\"Completed\",\"result\":\"Skipped\"}]}]}") + .toObject(SqlServerInstanceJobsStatusResponseInner.class); + Assertions.assertEquals("izsjqlhkrr", model.jobsStatus().get(0).id()); + Assertions.assertEquals("deibqip", model.jobsStatus().get(0).instanceName()); + Assertions.assertEquals(JobStatus.FAILED, model.jobsStatus().get(0).jobStatus()); + Assertions.assertEquals("vxndz", model.jobsStatus().get(0).jobException()); + Assertions.assertEquals(State.SUSPENDED, model.jobsStatus().get(0).backgroundJob().state()); + Assertions.assertEquals(ExecutionState.RUNNING, model.jobsStatus().get(0).backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-31T16:27:46Z"), + model.jobsStatus().get(0).backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-22T17:17:35Z"), + model.jobsStatus().get(0).backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.POSTPONED, + model.jobsStatus().get(0).backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-01T01:08:26Z"), + model.jobsStatus().get(0).backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-10T15:11:20Z"), + model.jobsStatus().get(0).backgroundJob().nextExecutionTime()); + Assertions.assertEquals("b", model.jobsStatus().get(0).sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.WAITING_PREDECESSORS, + model.jobsStatus().get(0).sequencerActions().get(0).state()); + Assertions.assertEquals(Result.TIMED_OUT, model.jobsStatus().get(0).sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java deleted file mode 100644 index 22e1ce7e80ea..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceListResult; - -public final class SqlServerInstanceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"version\":\"SQL Server 2019\",\"edition\":\"Web\",\"containerResourceId\":\"conuqszfkbeype\",\"createTime\":\"mjmwvvjektcx\",\"vCore\":\"nhwlrsffrzpwvl\",\"status\":\"Disconnected\",\"patchLevel\":\"gbiqylihkaet\",\"collation\":\"tvfcivfsn\",\"currentVersion\":\"m\",\"instanceName\":\"tqhjfbebrjcx\",\"tcpDynamicPorts\":\"fuwutttxf\",\"tcpStaticPorts\":\"rbirphxe\",\"productId\":\"yva\",\"licenseType\":\"Free\",\"azureDefenderStatusLastUpdated\":\"2021-04-15T16:11:33Z\",\"azureDefenderStatus\":\"Protected\",\"provisioningState\":\"xjvuujqgidokg\"},\"location\":\"jyoxgvclt\",\"tags\":{\"zz\":\"ncghkje\",\"mxnehmp\":\"bijhtxfvgxbf\",\"godebfqkkrbmpu\":\"ec\"},\"id\":\"gr\",\"name\":\"wflzlfbxzpuzy\",\"type\":\"ispnqzahmgkbrp\"},{\"properties\":{\"version\":\"SQL Server 2017\",\"edition\":\"Standard\",\"containerResourceId\":\"nuqqkpikadrgvt\",\"createTime\":\"gnbuy\",\"vCore\":\"ijggmebfsiar\",\"status\":\"Disconnected\",\"patchLevel\":\"rcvpnazzmhjrunmp\",\"collation\":\"tdbhrbnla\",\"currentVersion\":\"xmyskp\",\"instanceName\":\"enbtkcxywny\",\"tcpDynamicPorts\":\"rsyn\",\"tcpStaticPorts\":\"idybyxczf\",\"productId\":\"haaxdbabphl\",\"licenseType\":\"HADR\",\"azureDefenderStatusLastUpdated\":\"2021-04-06T00:21:45Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"thsu\"},\"location\":\"cmnyyazttb\",\"tags\":{\"uedck\":\"rq\",\"bxu\":\"ywbiexzfeyueax\"},\"id\":\"wbhqwal\",\"name\":\"uzyoxaep\",\"type\":\"kzjancuxrhdwbav\"},{\"properties\":{\"version\":\"SQL Server 2019\",\"edition\":\"Developer\",\"containerResourceId\":\"jswztsdbpg\",\"createTime\":\"ytxhp\",\"vCore\":\"bzpfzab\",\"status\":\"Unknown\",\"patchLevel\":\"uhxwtctyqiklbbov\",\"collation\":\"wzbhvgyugu\",\"currentVersion\":\"vmkfssxqu\",\"instanceName\":\"fpl\",\"tcpDynamicPorts\":\"gsxnkjzkdeslpv\",\"tcpStaticPorts\":\"pwiyig\",\"productId\":\"pkdwzbai\",\"licenseType\":\"HADR\",\"azureDefenderStatusLastUpdated\":\"2021-02-20T09:39:09Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"yqupedeojnabckh\"},\"location\":\"txp\",\"tags\":{\"rdqmhjjdhtldwkyz\":\"btfhvpesaps\",\"cwsvlxotog\":\"uutkncw\",\"o\":\"wrupqsxvnmicykvc\"},\"id\":\"eil\",\"name\":\"vnotyfjfcnj\",\"type\":\"k\"}],\"nextLink\":\"x\"}") - .toObject(SqlServerInstanceListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceListResult model = new SqlServerInstanceListResult(); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceListResult.class); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentRequestTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentRequestTests.java new file mode 100644 index 000000000000..409494082ea9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentRequestTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AzureManagedInstanceRole; +import com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceManagedInstanceLinkAssessmentRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceManagedInstanceLinkAssessmentRequest model = BinaryData.fromString( + "{\"azureManagedInstanceResourceId\":\"ccsnjvcdwxlpq\",\"azureManagedInstanceRole\":\"Primary\",\"databaseNames\":[\"nkhtjsyingw\"],\"availabilityGroupName\":\"qatmtdhtmdvy\",\"distributedAvailabilityGroupName\":\"gikdgsz\",\"assessmentCategories\":[\"SqlInstance\"],\"sqlServerIpAddress\":\"rryuzhlhkjo\"}") + .toObject(SqlServerInstanceManagedInstanceLinkAssessmentRequest.class); + Assertions.assertEquals("ccsnjvcdwxlpq", model.azureManagedInstanceResourceId()); + Assertions.assertEquals(AzureManagedInstanceRole.PRIMARY, model.azureManagedInstanceRole()); + Assertions.assertEquals("nkhtjsyingw", model.databaseNames().get(0)); + Assertions.assertEquals("qatmtdhtmdvy", model.availabilityGroupName()); + Assertions.assertEquals("gikdgsz", model.distributedAvailabilityGroupName()); + Assertions.assertEquals(MiLinkAssessmentCategory.SQL_INSTANCE, model.assessmentCategories().get(0)); + Assertions.assertEquals("rryuzhlhkjo", model.sqlServerIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerInstanceManagedInstanceLinkAssessmentRequest model + = new SqlServerInstanceManagedInstanceLinkAssessmentRequest() + .withAzureManagedInstanceResourceId("ccsnjvcdwxlpq") + .withAzureManagedInstanceRole(AzureManagedInstanceRole.PRIMARY) + .withDatabaseNames(Arrays.asList("nkhtjsyingw")) + .withAvailabilityGroupName("qatmtdhtmdvy") + .withDistributedAvailabilityGroupName("gikdgsz") + .withAssessmentCategories(Arrays.asList(MiLinkAssessmentCategory.SQL_INSTANCE)) + .withSqlServerIpAddress("rryuzhlhkjo"); + model = BinaryData.fromObject(model).toObject(SqlServerInstanceManagedInstanceLinkAssessmentRequest.class); + Assertions.assertEquals("ccsnjvcdwxlpq", model.azureManagedInstanceResourceId()); + Assertions.assertEquals(AzureManagedInstanceRole.PRIMARY, model.azureManagedInstanceRole()); + Assertions.assertEquals("nkhtjsyingw", model.databaseNames().get(0)); + Assertions.assertEquals("qatmtdhtmdvy", model.availabilityGroupName()); + Assertions.assertEquals("gikdgsz", model.distributedAvailabilityGroupName()); + Assertions.assertEquals(MiLinkAssessmentCategory.SQL_INSTANCE, model.assessmentCategories().get(0)); + Assertions.assertEquals("rryuzhlhkjo", model.sqlServerIpAddress()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentResponseInnerTests.java new file mode 100644 index 000000000000..cc8349071538 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentResponseInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceManagedInstanceLinkAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.AssessmentStatus; +import com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceManagedInstanceLinkAssessmentResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceManagedInstanceLinkAssessmentResponseInner model = BinaryData.fromString( + "{\"assessments\":[{\"name\":\"qaatjinrv\",\"category\":\"ManagedInstance\",\"status\":\"Failure\",\"information\":\"iibfggj\",\"additionalInformation\":\"olvrw\",\"failingDbs\":[\"tkkgllqwjy\"]},{\"name\":\"jayvblmhv\",\"category\":\"ManagedInstanceDatabase\",\"status\":\"Warning\",\"information\":\"vvyhg\",\"additionalInformation\":\"pbyrqufegxu\",\"failingDbs\":[\"fbn\"]},{\"name\":\"mctlpdngitv\",\"category\":\"ManagedInstanceDatabase\",\"status\":\"Success\",\"information\":\"xkw\",\"additionalInformation\":\"ijejvegrhbpn\",\"failingDbs\":[\"exccbdreaxhcexd\",\"rvqahqkghtpwi\",\"nhyjsv\",\"ycxzbfvoo\"]},{\"name\":\"rvmtgjq\",\"category\":\"Certificates\",\"status\":\"Success\",\"information\":\"ronzmyhgfip\",\"additionalInformation\":\"xkmcwaekrrjre\",\"failingDbs\":[\"tsgumhj\"]}]}") + .toObject(SqlServerInstanceManagedInstanceLinkAssessmentResponseInner.class); + Assertions.assertEquals("qaatjinrv", model.assessments().get(0).name()); + Assertions.assertEquals(MiLinkAssessmentCategory.MANAGED_INSTANCE, model.assessments().get(0).category()); + Assertions.assertEquals(AssessmentStatus.FAILURE, model.assessments().get(0).status()); + Assertions.assertEquals("iibfggj", model.assessments().get(0).information()); + Assertions.assertEquals("olvrw", model.assessments().get(0).additionalInformation()); + Assertions.assertEquals("tkkgllqwjy", model.assessments().get(0).failingDbs().get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentTests.java new file mode 100644 index 000000000000..d6f0d5f2b5c5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceManagedInstanceLinkAssessmentTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AssessmentStatus; +import com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessment; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceManagedInstanceLinkAssessmentTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceManagedInstanceLinkAssessment model = BinaryData.fromString( + "{\"name\":\"ikkx\",\"category\":\"SqlInstance\",\"status\":\"Warning\",\"information\":\"qpvuzlmvfelf\",\"additionalInformation\":\"gplcrpwjxeznoigb\",\"failingDbs\":[\"w\",\"wkpnbsaz\",\"jjoqkagf\"]}") + .toObject(SqlServerInstanceManagedInstanceLinkAssessment.class); + Assertions.assertEquals("ikkx", model.name()); + Assertions.assertEquals(MiLinkAssessmentCategory.SQL_INSTANCE, model.category()); + Assertions.assertEquals(AssessmentStatus.WARNING, model.status()); + Assertions.assertEquals("qpvuzlmvfelf", model.information()); + Assertions.assertEquals("gplcrpwjxeznoigb", model.additionalInformation()); + Assertions.assertEquals("w", model.failingDbs().get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceMigrationReadinessReportResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceMigrationReadinessReportResponseInnerTests.java new file mode 100644 index 000000000000..11759cc42f7c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceMigrationReadinessReportResponseInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceMigrationReadinessReportResponseInner; + +public final class SqlServerInstanceMigrationReadinessReportResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceMigrationReadinessReportResponseInner model = BinaryData + .fromString("{\"report\":\"icccn\",\"isCompressed\":false,\"createdTime\":\"2021-04-16T02:26:54Z\"}") + .toObject(SqlServerInstanceMigrationReadinessReportResponseInner.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java deleted file mode 100644 index 4644d152c031..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancePropertiesTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class SqlServerInstancePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceProperties model = BinaryData.fromString( - "{\"version\":\"SQL Server 2019\",\"edition\":\"Express\",\"containerResourceId\":\"exq\",\"createTime\":\"fadmws\",\"vCore\":\"r\",\"status\":\"Connected\",\"patchLevel\":\"pv\",\"collation\":\"mzlfmisgwb\",\"currentVersion\":\"beldawkzbaliourq\",\"instanceName\":\"kauhashsfwxo\",\"tcpDynamicPorts\":\"w\",\"tcpStaticPorts\":\"cugicjoox\",\"productId\":\"ebwpucwwfvo\",\"licenseType\":\"Free\",\"azureDefenderStatusLastUpdated\":\"2021-05-26T04:02:26Z\",\"azureDefenderStatus\":\"Protected\",\"provisioningState\":\"ivyhzceuojgjrwju\"}") - .toObject(SqlServerInstanceProperties.class); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, model.version()); - Assertions.assertEquals(EditionType.EXPRESS, model.edition()); - Assertions.assertEquals("exq", model.containerResourceId()); - Assertions.assertEquals("r", model.vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, model.status()); - Assertions.assertEquals("pv", model.patchLevel()); - Assertions.assertEquals("mzlfmisgwb", model.collation()); - Assertions.assertEquals("beldawkzbaliourq", model.currentVersion()); - Assertions.assertEquals("kauhashsfwxo", model.instanceName()); - Assertions.assertEquals("w", model.tcpDynamicPorts()); - Assertions.assertEquals("cugicjoox", model.tcpStaticPorts()); - Assertions.assertEquals("ebwpucwwfvo", model.productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.FREE, model.licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-26T04:02:26Z"), model.azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.PROTECTED, model.azureDefenderStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceProperties model = new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2019) - .withEdition(EditionType.EXPRESS) - .withContainerResourceId("exq") - .withVCore("r") - .withStatus(ConnectionStatus.CONNECTED) - .withPatchLevel("pv") - .withCollation("mzlfmisgwb") - .withCurrentVersion("beldawkzbaliourq") - .withInstanceName("kauhashsfwxo") - .withTcpDynamicPorts("w") - .withTcpStaticPorts("cugicjoox") - .withProductId("ebwpucwwfvo") - .withLicenseType(ArcSqlServerLicenseType.FREE) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-05-26T04:02:26Z")) - .withAzureDefenderStatus(DefenderStatus.PROTECTED); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceProperties.class); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, model.version()); - Assertions.assertEquals(EditionType.EXPRESS, model.edition()); - Assertions.assertEquals("exq", model.containerResourceId()); - Assertions.assertEquals("r", model.vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, model.status()); - Assertions.assertEquals("pv", model.patchLevel()); - Assertions.assertEquals("mzlfmisgwb", model.collation()); - Assertions.assertEquals("beldawkzbaliourq", model.currentVersion()); - Assertions.assertEquals("kauhashsfwxo", model.instanceName()); - Assertions.assertEquals("w", model.tcpDynamicPorts()); - Assertions.assertEquals("cugicjoox", model.tcpStaticPorts()); - Assertions.assertEquals("ebwpucwwfvo", model.productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.FREE, model.licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-26T04:02:26Z"), model.azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.PROTECTED, model.azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunBestPracticesAssessmentResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunBestPracticesAssessmentResponseInnerTests.java new file mode 100644 index 000000000000..5fb27c0fb128 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunBestPracticesAssessmentResponseInnerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunBestPracticesAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceRunBestPracticesAssessmentResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceRunBestPracticesAssessmentResponseInner model = BinaryData.fromString( + "{\"id\":\"mkttlstvlzywem\",\"instanceName\":\"rncsdtclu\",\"jobStatus\":\"Failed\",\"jobException\":\"bsfgytguslfea\",\"backgroundJob\":{\"state\":\"Active\",\"executionState\":\"Running\",\"startTime\":\"2021-11-04T08:30:12Z\",\"endTime\":\"2021-01-09T07:06:25Z\",\"lastExecutionStatus\":\"Completed\",\"lastExecutionTime\":\"2021-10-20T10:25:57Z\",\"nextExecutionTime\":\"2021-04-26T05:02:54Z\"},\"sequencerActions\":[{\"actionId\":\"elolppvksrpqvuj\",\"state\":\"CreatingSuccessors\",\"result\":\"TimedOut\"}]}") + .toObject(SqlServerInstanceRunBestPracticesAssessmentResponseInner.class); + Assertions.assertEquals("mkttlstvlzywem", model.id()); + Assertions.assertEquals("rncsdtclu", model.instanceName()); + Assertions.assertEquals(JobStatus.FAILED, model.jobStatus()); + Assertions.assertEquals("bsfgytguslfea", model.jobException()); + Assertions.assertEquals(State.ACTIVE, model.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.RUNNING, model.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T08:30:12Z"), model.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-09T07:06:25Z"), model.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.COMPLETED, model.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-20T10:25:57Z"), + model.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-26T05:02:54Z"), + model.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("elolppvksrpqvuj", model.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.CREATING_SUCCESSORS, model.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.TIMED_OUT, model.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunMigrationAssessmentResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunMigrationAssessmentResponseInnerTests.java new file mode 100644 index 000000000000..5b5ccac48d36 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunMigrationAssessmentResponseInnerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceRunMigrationAssessmentResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceRunMigrationAssessmentResponseInner model = BinaryData.fromString( + "{\"id\":\"knnqvsaznq\",\"instanceName\":\"orudsgsa\",\"jobStatus\":\"Succeeded\",\"jobException\":\"c\",\"backgroundJob\":{\"state\":\"Terminated\",\"executionState\":\"Running\",\"startTime\":\"2021-06-30T11:21:58Z\",\"endTime\":\"2021-03-24T10:52:29Z\",\"lastExecutionStatus\":\"Succeeded\",\"lastExecutionTime\":\"2021-02-13T20:01:22Z\",\"nextExecutionTime\":\"2021-09-21T03:41:44Z\"},\"sequencerActions\":[{\"actionId\":\"vsmzlxwab\",\"state\":\"Completed\",\"result\":\"Succeeded\"},{\"actionId\":\"ifrvtpu\",\"state\":\"ExecutingAction\",\"result\":\"Failed\"},{\"actionId\":\"gkfbtndoaong\",\"state\":\"NotStarted\",\"result\":\"Skipped\"},{\"actionId\":\"jitcjedftwwaez\",\"state\":\"CreatingSuccessors\",\"result\":\"Succeeded\"}]}") + .toObject(SqlServerInstanceRunMigrationAssessmentResponseInner.class); + Assertions.assertEquals("knnqvsaznq", model.id()); + Assertions.assertEquals("orudsgsa", model.instanceName()); + Assertions.assertEquals(JobStatus.SUCCEEDED, model.jobStatus()); + Assertions.assertEquals("c", model.jobException()); + Assertions.assertEquals(State.TERMINATED, model.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.RUNNING, model.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-30T11:21:58Z"), model.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-24T10:52:29Z"), model.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.SUCCEEDED, model.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-13T20:01:22Z"), + model.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-21T03:41:44Z"), + model.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("vsmzlxwab", model.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.COMPLETED, model.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.SUCCEEDED, model.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunMigrationReadinessAssessmentResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunMigrationReadinessAssessmentResponseInnerTests.java new file mode 100644 index 000000000000..46a07ecc2daf --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunMigrationReadinessAssessmentResponseInnerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunMigrationReadinessAssessmentResponseInner; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceRunMigrationReadinessAssessmentResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceRunMigrationReadinessAssessmentResponseInner model = BinaryData.fromString( + "{\"id\":\"w\",\"instanceName\":\"r\",\"jobStatus\":\"InProgress\",\"jobException\":\"iby\",\"backgroundJob\":{\"state\":\"Terminated\",\"executionState\":\"Waiting\",\"startTime\":\"2021-08-20T01:53Z\",\"endTime\":\"2021-05-20T23:38:11Z\",\"lastExecutionStatus\":\"Rescheduled\",\"lastExecutionTime\":\"2021-08-31T16:01:42Z\",\"nextExecutionTime\":\"2021-08-09T11:17:34Z\"},\"sequencerActions\":[{\"actionId\":\"ykhevxccedcpnmdy\",\"state\":\"ExecutingAction\",\"result\":\"NotCompleted\"},{\"actionId\":\"ltjcvnhltiugcxna\",\"state\":\"WaitingPredecessors\",\"result\":\"Skipped\"}]}") + .toObject(SqlServerInstanceRunMigrationReadinessAssessmentResponseInner.class); + Assertions.assertEquals("w", model.id()); + Assertions.assertEquals("r", model.instanceName()); + Assertions.assertEquals(JobStatus.IN_PROGRESS, model.jobStatus()); + Assertions.assertEquals("iby", model.jobException()); + Assertions.assertEquals(State.TERMINATED, model.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, model.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-20T01:53Z"), model.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-20T23:38:11Z"), model.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.RESCHEDULED, model.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-31T16:01:42Z"), + model.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-09T11:17:34Z"), + model.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("ykhevxccedcpnmdy", model.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.EXECUTING_ACTION, model.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.NOT_COMPLETED, model.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunTargetRecommendationJobRequestTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunTargetRecommendationJobRequestTests.java new file mode 100644 index 000000000000..abc911284563 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunTargetRecommendationJobRequestTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ResourceUpdateMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceRunTargetRecommendationJobRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceRunTargetRecommendationJobRequest model = BinaryData.fromString( + "{\"resourceUpdateMode\":\"SkipResourceUpdate\",\"includeFileLevelRequirements\":false,\"targetLocation\":\"p\",\"percentile\":2028743450,\"lookbackPeriodInDays\":1543353321}") + .toObject(SqlServerInstanceRunTargetRecommendationJobRequest.class); + Assertions.assertEquals(ResourceUpdateMode.SKIP_RESOURCE_UPDATE, model.resourceUpdateMode()); + Assertions.assertFalse(model.includeFileLevelRequirements()); + Assertions.assertEquals("p", model.targetLocation()); + Assertions.assertEquals(2028743450, model.percentile()); + Assertions.assertEquals(1543353321, model.lookbackPeriodInDays()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerInstanceRunTargetRecommendationJobRequest model + = new SqlServerInstanceRunTargetRecommendationJobRequest() + .withResourceUpdateMode(ResourceUpdateMode.SKIP_RESOURCE_UPDATE) + .withIncludeFileLevelRequirements(false) + .withTargetLocation("p") + .withPercentile(2028743450) + .withLookbackPeriodInDays(1543353321); + model = BinaryData.fromObject(model).toObject(SqlServerInstanceRunTargetRecommendationJobRequest.class); + Assertions.assertEquals(ResourceUpdateMode.SKIP_RESOURCE_UPDATE, model.resourceUpdateMode()); + Assertions.assertFalse(model.includeFileLevelRequirements()); + Assertions.assertEquals("p", model.targetLocation()); + Assertions.assertEquals(2028743450, model.percentile()); + Assertions.assertEquals(1543353321, model.lookbackPeriodInDays()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunTargetRecommendationJobResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunTargetRecommendationJobResponseInnerTests.java new file mode 100644 index 000000000000..5e07b45f6c00 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceRunTargetRecommendationJobResponseInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceRunTargetRecommendationJobResponseInner; + +public final class SqlServerInstanceRunTargetRecommendationJobResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceRunTargetRecommendationJobResponseInner model + = BinaryData.fromString("{\"jobStatus\":\"Failed\"}") + .toObject(SqlServerInstanceRunTargetRecommendationJobResponseInner.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportSectionTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportSectionTests.java new file mode 100644 index 000000000000..9b94744dec28 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportSectionTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSection; + +public final class SqlServerInstanceTargetRecommendationReportSectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTargetRecommendationReportSection model = BinaryData.fromString( + "{\"data\":\"mhairsbrgzdwmsw\",\"type\":\"SqlMiTargetRecommendationPerInstance\",\"databaseName\":\"w\",\"isCompressed\":true}") + .toObject(SqlServerInstanceTargetRecommendationReportSection.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportTests.java new file mode 100644 index 000000000000..e9c9aebbc04c --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReport; + +public final class SqlServerInstanceTargetRecommendationReportTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTargetRecommendationReport model = BinaryData.fromString( + "{\"reportId\":\"oqzpiyylha\",\"createdTime\":\"2021-07-29T02:17:13Z\",\"sections\":[{\"data\":\"csphkaiv\",\"type\":\"FileRequirementsPerDatabase\",\"databaseName\":\"scywuggwoluhc\",\"isCompressed\":false}]}") + .toObject(SqlServerInstanceTargetRecommendationReport.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportsRequestTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportsRequestTests.java new file mode 100644 index 000000000000..4efff94335ce --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportsRequestTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSectionType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceTargetRecommendationReportsRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTargetRecommendationReportsRequest model = BinaryData.fromString( + "{\"reportOffset\":1263985401,\"sectionOffset\":1660457179,\"sectionType\":\"SqlDbTargetRecommendationPerDatabase\",\"databaseNames\":[\"khnzbonlw\",\"toego\",\"dwbwhkszzcmrvexz\",\"vbtqgsfraoyzk\"]}") + .toObject(SqlServerInstanceTargetRecommendationReportsRequest.class); + Assertions.assertEquals(1263985401, model.reportOffset()); + Assertions.assertEquals(1660457179, model.sectionOffset()); + Assertions.assertEquals( + SqlServerInstanceTargetRecommendationReportSectionType.SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE, + model.sectionType()); + Assertions.assertEquals("khnzbonlw", model.databaseNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerInstanceTargetRecommendationReportsRequest model + = new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(1263985401) + .withSectionOffset(1660457179) + .withSectionType( + SqlServerInstanceTargetRecommendationReportSectionType.SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE) + .withDatabaseNames(Arrays.asList("khnzbonlw", "toego", "dwbwhkszzcmrvexz", "vbtqgsfraoyzk")); + model = BinaryData.fromObject(model).toObject(SqlServerInstanceTargetRecommendationReportsRequest.class); + Assertions.assertEquals(1263985401, model.reportOffset()); + Assertions.assertEquals(1660457179, model.sectionOffset()); + Assertions.assertEquals( + SqlServerInstanceTargetRecommendationReportSectionType.SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE, + model.sectionType()); + Assertions.assertEquals("khnzbonlw", model.databaseNames().get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportsResponseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportsResponseInnerTests.java new file mode 100644 index 000000000000..fde788e26e2f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTargetRecommendationReportsResponseInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerInstanceTargetRecommendationReportsResponseInner; + +public final class SqlServerInstanceTargetRecommendationReportsResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTargetRecommendationReportsResponseInner model = BinaryData.fromString( + "{\"jobStatus\":\"NotStarted\",\"reports\":[{\"reportId\":\"nguxawqaldsy\",\"createdTime\":\"2021-04-11T11:41:56Z\",\"sections\":[{\"data\":\"rqf\",\"type\":\"SqlDbTargetRecommendationPerDatabase\",\"databaseName\":\"znkbykutwpfhpagm\",\"isCompressed\":true},{\"data\":\"dsnfdsdoakgtdl\",\"type\":\"RequirementsPerInstance\",\"databaseName\":\"evdlh\",\"isCompressed\":false},{\"data\":\"sdsttwvog\",\"type\":\"SqlVmTargetRecommendationPerInstance\",\"databaseName\":\"jdcngqqm\",\"isCompressed\":false},{\"data\":\"fgmjzrwrdgrt\",\"type\":\"RequirementsPerInstance\",\"databaseName\":\"u\",\"isCompressed\":true}]},{\"reportId\":\"pbminr\",\"createdTime\":\"2021-06-23T20:23:29Z\",\"sections\":[{\"data\":\"hhziuief\",\"type\":\"RequirementsPerDatabase\",\"databaseName\":\"dmsmlm\",\"isCompressed\":false},{\"data\":\"ft\",\"type\":\"RequirementsPerInstance\",\"databaseName\":\"qu\",\"isCompressed\":true}]}],\"totalReportCount\":1894418598,\"nextReportOffset\":997534180,\"nextSectionOffset\":1331463794}") + .toObject(SqlServerInstanceTargetRecommendationReportsResponseInner.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryColumnTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryColumnTests.java new file mode 100644 index 000000000000..1488f808238e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryColumnTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryColumn; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryColumnType; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceTelemetryColumnTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTelemetryColumn model + = BinaryData.fromString("{\"name\":\"pulpqblylsyxk\",\"type\":\"datetime\"}") + .toObject(SqlServerInstanceTelemetryColumn.class); + Assertions.assertEquals("pulpqblylsyxk", model.name()); + Assertions.assertEquals(SqlServerInstanceTelemetryColumnType.DATETIME, model.type()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryRequestTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryRequestTests.java new file mode 100644 index 000000000000..d4c9a2eb7689 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryRequestTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.AggregationType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryRequest; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceTelemetryRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTelemetryRequest model = BinaryData.fromString( + "{\"datasetName\":\"rqubpaxhexiil\",\"startTime\":\"2021-10-29T07:32:45Z\",\"endTime\":\"2021-07-15T19:19:41Z\",\"interval\":\"PT30H54M46S\",\"aggregationType\":\"Sum\",\"databaseNames\":[\"qoaxoruzfgs\"]}") + .toObject(SqlServerInstanceTelemetryRequest.class); + Assertions.assertEquals("rqubpaxhexiil", model.datasetName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T07:32:45Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-15T19:19:41Z"), model.endTime()); + Assertions.assertEquals(Duration.parse("PT30H54M46S"), model.interval()); + Assertions.assertEquals(AggregationType.SUM, model.aggregationType()); + Assertions.assertEquals("qoaxoruzfgs", model.databaseNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerInstanceTelemetryRequest model + = new SqlServerInstanceTelemetryRequest().withDatasetName("rqubpaxhexiil") + .withStartTime(OffsetDateTime.parse("2021-10-29T07:32:45Z")) + .withEndTime(OffsetDateTime.parse("2021-07-15T19:19:41Z")) + .withInterval(Duration.parse("PT30H54M46S")) + .withAggregationType(AggregationType.SUM) + .withDatabaseNames(Arrays.asList("qoaxoruzfgs")); + model = BinaryData.fromObject(model).toObject(SqlServerInstanceTelemetryRequest.class); + Assertions.assertEquals("rqubpaxhexiil", model.datasetName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T07:32:45Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-15T19:19:41Z"), model.endTime()); + Assertions.assertEquals(Duration.parse("PT30H54M46S"), model.interval()); + Assertions.assertEquals(AggregationType.SUM, model.aggregationType()); + Assertions.assertEquals("qoaxoruzfgs", model.databaseNames().get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryResponseTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryResponseTests.java new file mode 100644 index 000000000000..8d622398eb25 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceTelemetryResponseTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerInstanceTelemetryResponse; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTelemetryColumnType; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerInstanceTelemetryResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerInstanceTelemetryResponse model = BinaryData.fromString( + "{\"columns\":[{\"name\":\"fxrxxle\",\"type\":\"string\"},{\"name\":\"mxjezwlw\",\"type\":\"string\"},{\"name\":\"qlcvydy\",\"type\":\"long\"},{\"name\":\"ooaojkniodkooebw\",\"type\":\"int\"}],\"rows\":[[\"mmsbvdkcrodtjin\",\"wj\",\"fltkacjv\"],[\"kdlfoa\"]],\"nextLink\":\"gkfpaga\"}") + .toObject(SqlServerInstanceTelemetryResponse.class); + Assertions.assertEquals("fxrxxle", model.columns().get(0).name()); + Assertions.assertEquals(SqlServerInstanceTelemetryColumnType.STRING, model.columns().get(0).type()); + Assertions.assertEquals("mmsbvdkcrodtjin", model.rows().get(0).get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java deleted file mode 100644 index 7705ce8b94b1..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstanceUpdateTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceUpdate; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SqlServerInstanceUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SqlServerInstanceUpdate model - = BinaryData.fromString("{\"tags\":{\"dytdxwitx\":\"twm\",\"qwgxhniskx\":\"rjaw\"}}") - .toObject(SqlServerInstanceUpdate.class); - Assertions.assertEquals("twm", model.tags().get("dytdxwitx")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SqlServerInstanceUpdate model - = new SqlServerInstanceUpdate().withTags(mapOf("dytdxwitx", "twm", "qwgxhniskx", "rjaw")); - model = BinaryData.fromObject(model).toObject(SqlServerInstanceUpdate.class); - Assertions.assertEquals("twm", model.tags().get("dytdxwitx")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java deleted file mode 100644 index 6d95308f8e10..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesCreateMockTests.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesCreateMockTests { - @Test - public void testCreate() throws Exception { - String responseStr - = "{\"properties\":{\"version\":\"SQL Server 2019\",\"edition\":\"Express\",\"containerResourceId\":\"hdgqggeb\",\"createTime\":\"nyga\",\"vCore\":\"idb\",\"status\":\"Connected\",\"patchLevel\":\"t\",\"collation\":\"llrxcyjmoad\",\"currentVersion\":\"varmywdmj\",\"instanceName\":\"q\",\"tcpDynamicPorts\":\"hhyxxrw\",\"tcpStaticPorts\":\"co\",\"productId\":\"hp\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-01-03T15:01:22Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"Succeeded\"},\"location\":\"ddg\",\"tags\":{\"i\":\"fwqmzqalkrmn\"},\"id\":\"pxacqqudfn\",\"name\":\"yxbaaabjyvayf\",\"type\":\"imrzrtuzqog\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - AzureArcDataManager manager = AzureArcDataManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SqlServerInstance response = manager.sqlServerInstances() - .define("kallatmel") - .withRegion("jawneaiv") - .withExistingResourceGroup("zikywgg") - .withTags(mapOf("c", "zel", "lsfeaenwabfatkld", "r", "oulpjrv", "xbjhwuaanozjosph")) - .withProperties(new SqlServerInstanceProperties().withVersion(SqlVersion.SQL_SERVER_2019) - .withEdition(EditionType.STANDARD) - .withContainerResourceId("cjzkzivgvvcna") - .withVCore("dndrdvstkwqqtche") - .withStatus(ConnectionStatus.UNKNOWN) - .withPatchLevel("fmtdaaygdvwvgp") - .withCollation("hgwxrtfudx") - .withCurrentVersion("xg") - .withInstanceName("agvrvmnpkuk") - .withTcpDynamicPorts("i") - .withTcpStaticPorts("blxgwimf") - .withProductId("hfjx") - .withLicenseType(ArcSqlServerLicenseType.HADR) - .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-10-16T12:46:55Z")) - .withAzureDefenderStatus(DefenderStatus.UNPROTECTED)) - .create(); - - Assertions.assertEquals("ddg", response.location()); - Assertions.assertEquals("fwqmzqalkrmn", response.tags().get("i")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, response.properties().version()); - Assertions.assertEquals(EditionType.EXPRESS, response.properties().edition()); - Assertions.assertEquals("hdgqggeb", response.properties().containerResourceId()); - Assertions.assertEquals("idb", response.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, response.properties().status()); - Assertions.assertEquals("t", response.properties().patchLevel()); - Assertions.assertEquals("llrxcyjmoad", response.properties().collation()); - Assertions.assertEquals("varmywdmj", response.properties().currentVersion()); - Assertions.assertEquals("q", response.properties().instanceName()); - Assertions.assertEquals("hhyxxrw", response.properties().tcpDynamicPorts()); - Assertions.assertEquals("co", response.properties().tcpStaticPorts()); - Assertions.assertEquals("hp", response.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, response.properties().licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-03T15:01:22Z"), - response.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNKNOWN, response.properties().azureDefenderStatus()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java index 592ff491a08f..a21858baac49 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesDeleteMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; import java.nio.charset.StandardCharsets; @@ -25,9 +25,9 @@ public void testDelete() throws Exception { AzureArcDataManager manager = AzureArcDataManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - manager.sqlServerInstances().delete("hnvpamqgxq", "u", com.azure.core.util.Context.NONE); + manager.sqlServerInstances().delete("nhvlqjbekp", "eksnbksdqhjvyk", com.azure.core.util.Context.NONE); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetAllAvailabilityGroupsMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetAllAvailabilityGroupsMockTests.java new file mode 100644 index 000000000000..a92207e9c07d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetAllAvailabilityGroupsMockTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerAvailabilityGroupTypeFilter; +import com.azure.resourcemanager.azurearcdata.models.AvailabilityGroupRetrievalFilters; +import com.azure.resourcemanager.azurearcdata.models.ReplicationPartnerType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerAvailabilityGroupResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesGetAllAvailabilityGroupsMockTests { + @Test + public void testGetAllAvailabilityGroups() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"availabilityGroupId\":\"qcs\",\"serverName\":\"chkhufm\",\"instanceName\":\"umqy\",\"vmId\":\"ydzulodsaeuzan\",\"collectionTimestamp\":\"2021-08-07T14:43:50Z\",\"info\":{\"failureConditionLevel\":53918322,\"healthCheckTimeout\":1029504848,\"automatedBackupPreferenceDescription\":\"phpzfngqjcl\",\"version\":304312927,\"basicFeatures\":false,\"dtcSupport\":false,\"dbFailover\":true,\"isDistributed\":true,\"clusterTypeDescription\":\"beqrkuorh\",\"requiredSynchronizedSecondariesToCommit\":354564561,\"isContained\":true,\"primaryReplica\":\"nmdvha\",\"primaryRecoveryHealthDescription\":\"vjytiqswbq\",\"secondaryRecoveryHealthDescription\":\"zwxiytx\",\"synchronizationHealthDescription\":\"gukvlbpkt\",\"replicationPartnerType\":\"AzureSQLVM\",\"listener\":{\"dnsName\":\"ouambewre\",\"ipV4AddressesAndMasks\":[{},{}],\"ipV6Addresses\":[\"egmmuteyxe\"],\"port\":764961144}},\"replicas\":{\"value\":[{\"replicaId\":\"jiitnspxlzdesygr\",\"replicaName\":\"waiufanra\",\"replicaResourceId\":\"fueqfrojs\",\"configure\":{},\"state\":{}},{\"replicaId\":\"h\",\"replicaName\":\"k\",\"replicaResourceId\":\"ywezskiecafyg\",\"configure\":{},\"state\":{}},{\"replicaId\":\"eqvdsm\",\"replicaName\":\"lixqcah\",\"replicaResourceId\":\"xalybxawoijpo\",\"configure\":{},\"state\":{}},{\"replicaId\":\"xpkk\",\"replicaName\":\"djodqhy\",\"replicaResourceId\":\"ncn\",\"configure\":{},\"state\":{}}],\"nextLink\":\"hllizhceumoq\"},\"databases\":{\"value\":[{\"databaseName\":\"ppyi\",\"replicaName\":\"gqladywrxwhyd\",\"isLocal\":true,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"ds\",\"isCommitParticipant\":true,\"synchronizationHealthDescription\":\"uyem\",\"databaseStateDescription\":\"wuowhlxlnwy\",\"isSuspended\":false,\"suspendReasonDescription\":\"vblgmokzk\"},{\"databaseName\":\"rfowtdvrfmvlih\",\"replicaName\":\"jdrqcrjidhftu\",\"isLocal\":false,\"isPrimaryReplica\":false,\"synchronizationStateDescription\":\"wyojbfqzdkfnjyi\",\"isCommitParticipant\":false,\"synchronizationHealthDescription\":\"ratqxmbjro\",\"databaseStateDescription\":\"zznval\",\"isSuspended\":true,\"suspendReasonDescription\":\"uzgfxonjtpusl\"}],\"nextLink\":\"wpvtiotzbpdbol\"},\"provisioningState\":\"ryf\"},\"location\":\"uasigr\",\"tags\":{\"qjkqevadrmmwi\":\"ocnequygdjboqgrm\",\"scz\":\"awvcmjzkxiid\",\"rrcoi\":\"koswoqiqazugamxz\",\"kuztdsbezaxyfu\":\"sbamnppcc\"},\"id\":\"zxuizhyhnepkpe\",\"name\":\"iarxqiubxdukec\",\"type\":\"xdazv\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.sqlServerInstances() + .getAllAvailabilityGroups("ctteajohi", "gspnbonhpczykm", + new AvailabilityGroupRetrievalFilters() + .withAvailabilityGroupTypeFilter(ArcSqlServerAvailabilityGroupTypeFilter.DEFAULT) + .withReplicationPartnerTypeFilter(ReplicationPartnerType.UNKNOWN), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("uasigr", response.iterator().next().location()); + Assertions.assertEquals("ocnequygdjboqgrm", response.iterator().next().tags().get("qjkqevadrmmwi")); + Assertions.assertEquals(53918322, response.iterator().next().properties().info().failureConditionLevel()); + Assertions.assertEquals(1029504848, response.iterator().next().properties().info().healthCheckTimeout()); + Assertions.assertFalse(response.iterator().next().properties().info().basicFeatures()); + Assertions.assertFalse(response.iterator().next().properties().info().dtcSupport()); + Assertions.assertTrue(response.iterator().next().properties().info().dbFailover()); + Assertions.assertTrue(response.iterator().next().properties().info().isDistributed()); + Assertions.assertEquals(354564561, + response.iterator().next().properties().info().requiredSynchronizedSecondariesToCommit()); + Assertions.assertTrue(response.iterator().next().properties().info().isContained()); + Assertions.assertEquals("ouambewre", response.iterator().next().properties().info().listener().dnsName()); + Assertions.assertEquals("egmmuteyxe", + response.iterator().next().properties().info().listener().ipV6Addresses().get(0)); + Assertions.assertEquals(764961144, response.iterator().next().properties().info().listener().port()); + Assertions.assertEquals("waiufanra", + response.iterator().next().properties().replicas().value().get(0).replicaName()); + Assertions.assertEquals("fueqfrojs", + response.iterator().next().properties().replicas().value().get(0).replicaResourceId()); + Assertions.assertEquals("ppyi", + response.iterator().next().properties().databases().value().get(0).databaseName()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index bd2cca37ea78..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"version\":\"SQL Server 2016\",\"edition\":\"Standard\",\"containerResourceId\":\"n\",\"createTime\":\"ph\",\"vCore\":\"pxodlqiyntorzih\",\"status\":\"Connected\",\"patchLevel\":\"sjswsrms\",\"collation\":\"zrpzb\",\"currentVersion\":\"ckqqzqioxiysui\",\"instanceName\":\"ynkedyatrwyhqmib\",\"tcpDynamicPorts\":\"hwit\",\"tcpStaticPorts\":\"ypyynpcdpumnzg\",\"productId\":\"z\",\"licenseType\":\"Free\",\"azureDefenderStatusLastUpdated\":\"2020-12-29T02:38:39Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"orgjhxbldt\"},\"location\":\"wrlkdmtn\",\"tags\":{\"xdy\":\"kotl\"},\"id\":\"gsyocogj\",\"name\":\"tdtbnnhadooc\",\"type\":\"kvci\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - AzureArcDataManager manager = AzureArcDataManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SqlServerInstance response = manager.sqlServerInstances() - .getByResourceGroupWithResponse("bwwift", "hqkvpuvksgplsak", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("wrlkdmtn", response.location()); - Assertions.assertEquals("kotl", response.tags().get("xdy")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2016, response.properties().version()); - Assertions.assertEquals(EditionType.STANDARD, response.properties().edition()); - Assertions.assertEquals("n", response.properties().containerResourceId()); - Assertions.assertEquals("pxodlqiyntorzih", response.properties().vCore()); - Assertions.assertEquals(ConnectionStatus.CONNECTED, response.properties().status()); - Assertions.assertEquals("sjswsrms", response.properties().patchLevel()); - Assertions.assertEquals("zrpzb", response.properties().collation()); - Assertions.assertEquals("ckqqzqioxiysui", response.properties().currentVersion()); - Assertions.assertEquals("ynkedyatrwyhqmib", response.properties().instanceName()); - Assertions.assertEquals("hwit", response.properties().tcpDynamicPorts()); - Assertions.assertEquals("ypyynpcdpumnzg", response.properties().tcpStaticPorts()); - Assertions.assertEquals("z", response.properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.FREE, response.properties().licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2020-12-29T02:38:39Z"), - response.properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNPROTECTED, response.properties().azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsMockTests.java new file mode 100644 index 000000000000..30a2fcfd5d14 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsMockTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsResponse; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesGetJobsMockTests { + @Test + public void testGetJobs() throws Exception { + String responseStr + = "{\"jobs\":[{\"id\":\"mcqmiciijqp\",\"instanceName\":\"fbojxjmcsmyqwix\",\"jobStatus\":\"Succeeded\",\"jobException\":\"nkwywzwofa\",\"backgroundJob\":{\"state\":\"Deleted\",\"executionState\":\"Waiting\",\"startTime\":\"2021-08-28T15:59:58Z\",\"endTime\":\"2021-11-27T18:16:26Z\",\"lastExecutionStatus\":\"Succeeded\",\"lastExecutionTime\":\"2021-05-12T19:00:31Z\",\"nextExecutionTime\":\"2021-07-28T03:33:13Z\"},\"sequencerActions\":[{\"actionId\":\"rwzawnvs\",\"state\":\"CreatingSuccessors\",\"result\":\"Failed\"},{\"actionId\":\"gxnvhyc\",\"state\":\"WaitingPredecessors\",\"result\":\"Succeeded\"},{\"actionId\":\"zregzgyufutrwpw\",\"state\":\"WaitingPredecessors\",\"result\":\"Failed\"}]},{\"id\":\"kdhmeottawjyosx\",\"instanceName\":\"hnhjtfvpndpmi\",\"jobStatus\":\"NotStarted\",\"jobException\":\"wyn\",\"backgroundJob\":{\"state\":\"Inactive\",\"executionState\":\"Waiting\",\"startTime\":\"2021-06-07T13:24:20Z\",\"endTime\":\"2021-08-29T15:21:50Z\",\"lastExecutionStatus\":\"Completed\",\"lastExecutionTime\":\"2021-10-25T06:59:07Z\",\"nextExecutionTime\":\"2021-07-31T15:26:28Z\"},\"sequencerActions\":[{\"actionId\":\"iqhzlr\",\"state\":\"NotStarted\",\"result\":\"Failed\"},{\"actionId\":\"lskihmxrfdsajred\",\"state\":\"WaitingPredecessors\",\"result\":\"Succeeded\"},{\"actionId\":\"t\",\"state\":\"NotStarted\",\"result\":\"Succeeded\"},{\"actionId\":\"uafpwzyifrk\",\"state\":\"NotStarted\",\"result\":\"Failed\"}]}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceJobsResponse response = manager.sqlServerInstances() + .getJobs("wvua", "bwbqamt", + new SqlServerInstanceJobsRequest().withFeatureName("liys").withJobType("kcvmwfauxxepmy"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mcqmiciijqp", response.jobs().get(0).id()); + Assertions.assertEquals("fbojxjmcsmyqwix", response.jobs().get(0).instanceName()); + Assertions.assertEquals(JobStatus.SUCCEEDED, response.jobs().get(0).jobStatus()); + Assertions.assertEquals("nkwywzwofa", response.jobs().get(0).jobException()); + Assertions.assertEquals(State.DELETED, response.jobs().get(0).backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, response.jobs().get(0).backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-28T15:59:58Z"), + response.jobs().get(0).backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-27T18:16:26Z"), + response.jobs().get(0).backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.SUCCEEDED, + response.jobs().get(0).backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-12T19:00:31Z"), + response.jobs().get(0).backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-28T03:33:13Z"), + response.jobs().get(0).backgroundJob().nextExecutionTime()); + Assertions.assertEquals("rwzawnvs", response.jobs().get(0).sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.CREATING_SUCCESSORS, + response.jobs().get(0).sequencerActions().get(0).state()); + Assertions.assertEquals(Result.FAILED, response.jobs().get(0).sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusWithResponseMockTests.java new file mode 100644 index 000000000000..9273792027a9 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetJobsStatusWithResponseMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceJobsStatusResponse; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesGetJobsStatusWithResponseMockTests { + @Test + public void testGetJobsStatusWithResponse() throws Exception { + String responseStr + = "{\"jobsStatus\":[{\"id\":\"mqxuc\",\"instanceName\":\"ijo\",\"jobStatus\":\"Succeeded\",\"jobException\":\"utgjcyz\",\"backgroundJob\":{\"state\":\"Completed\",\"executionState\":\"Waiting\",\"startTime\":\"2021-10-15T01:34:20Z\",\"endTime\":\"2021-12-10T20:36:59Z\",\"lastExecutionStatus\":\"Faulted\",\"lastExecutionTime\":\"2021-11-29T05:51:30Z\",\"nextExecutionTime\":\"2021-09-27T03:15:26Z\"},\"sequencerActions\":[{\"actionId\":\"z\",\"state\":\"CreatingSuccessors\",\"result\":\"Skipped\"}]}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceJobsStatusResponse response + = manager.sqlServerInstances() + .getJobsStatusWithResponse("uefzho", "p", + new SqlServerInstanceJobsStatusRequest().withFeatureName("qdurelyujlfyoum") + .withJobType("kyeclcdigpta"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("mqxuc", response.jobsStatus().get(0).id()); + Assertions.assertEquals("ijo", response.jobsStatus().get(0).instanceName()); + Assertions.assertEquals(JobStatus.SUCCEEDED, response.jobsStatus().get(0).jobStatus()); + Assertions.assertEquals("utgjcyz", response.jobsStatus().get(0).jobException()); + Assertions.assertEquals(State.COMPLETED, response.jobsStatus().get(0).backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, response.jobsStatus().get(0).backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-15T01:34:20Z"), + response.jobsStatus().get(0).backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-10T20:36:59Z"), + response.jobsStatus().get(0).backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.FAULTED, + response.jobsStatus().get(0).backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-29T05:51:30Z"), + response.jobsStatus().get(0).backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-27T03:15:26Z"), + response.jobsStatus().get(0).backgroundJob().nextExecutionTime()); + Assertions.assertEquals("z", response.jobsStatus().get(0).sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.CREATING_SUCCESSORS, + response.jobsStatus().get(0).sequencerActions().get(0).state()); + Assertions.assertEquals(Result.SKIPPED, response.jobsStatus().get(0).sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetMigrationReadinessReportMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetMigrationReadinessReportMockTests.java new file mode 100644 index 000000000000..ec0fdf8470c0 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetMigrationReadinessReportMockTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceMigrationReadinessReportResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesGetMigrationReadinessReportMockTests { + @Test + public void testGetMigrationReadinessReport() throws Exception { + String responseStr = "{\"report\":\"p\",\"isCompressed\":false,\"createdTime\":\"2021-08-12T21:07:24Z\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceMigrationReadinessReportResponse response = manager.sqlServerInstances() + .getMigrationReadinessReport("s", "ykgsangpszng", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTargetRecommendationReportsMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTargetRecommendationReportsMockTests.java new file mode 100644 index 000000000000..c5bbc61a565d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesGetTargetRecommendationReportsMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportSectionType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceTargetRecommendationReportsResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesGetTargetRecommendationReportsMockTests { + @Test + public void testGetTargetRecommendationReports() throws Exception { + String responseStr + = "{\"jobStatus\":\"NotStarted\",\"reports\":[{\"reportId\":\"tl\",\"createdTime\":\"2021-05-01T06:39:40Z\",\"sections\":[{\"data\":\"wiv\",\"type\":\"FileRequirementsPerDatabase\",\"databaseName\":\"rxhxkn\",\"isCompressed\":true},{\"data\":\"mmkyu\",\"type\":\"FileRequirementsPerDatabase\",\"databaseName\":\"byqjfkakfqfrkem\",\"isCompressed\":true},{\"data\":\"udxjascowv\",\"type\":\"SqlVmTargetRecommendationPerInstance\",\"databaseName\":\"pdxphlkksnmgzvyf\",\"isCompressed\":false},{\"data\":\"zuqnwsithuqo\",\"type\":\"RequirementsPerInstance\",\"databaseName\":\"luqw\",\"isCompressed\":false}]},{\"reportId\":\"utrjbhxyk\",\"createdTime\":\"2021-01-05T17:55:45Z\",\"sections\":[{\"data\":\"vqqugdrftbcv\",\"type\":\"SqlDbTargetRecommendationPerDatabase\",\"databaseName\":\"uquowtljvfwhr\",\"isCompressed\":true},{\"data\":\"hyxvrqt\",\"type\":\"RequirementsPerDatabase\",\"databaseName\":\"sulmd\",\"isCompressed\":false}]}],\"totalReportCount\":1426599328,\"nextReportOffset\":2085046578,\"nextSectionOffset\":449681471}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceTargetRecommendationReportsResponse response = manager.sqlServerInstances() + .getTargetRecommendationReports("ggmuwdcho", "fnkf", + new SqlServerInstanceTargetRecommendationReportsRequest().withReportOffset(273920655) + .withSectionOffset(273234198) + .withSectionType( + SqlServerInstanceTargetRecommendationReportSectionType.SQL_DB_TARGET_RECOMMENDATION_PER_DATABASE) + .withDatabaseNames(Arrays.asList("izvoaiknaqlnuwi", "uyxlykwphvxzcw")), + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java deleted file mode 100644 index 4f557cf50770..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListByResourceGroupMockTests.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"version\":\"SQL Server 2019\",\"edition\":\"Web\",\"containerResourceId\":\"lxprglyatddckcbc\",\"createTime\":\"jrjxgciqibrhosx\",\"vCore\":\"qrhzoymibmrqyib\",\"status\":\"Unknown\",\"patchLevel\":\"fluszdtm\",\"collation\":\"kwofyyvoq\",\"currentVersion\":\"piexpbtgiw\",\"instanceName\":\"oenwashr\",\"tcpDynamicPorts\":\"tkcnqxwb\",\"tcpStaticPorts\":\"kulpiujwaasi\",\"productId\":\"i\",\"licenseType\":\"HADR\",\"azureDefenderStatusLastUpdated\":\"2021-06-07T23:06:40Z\",\"azureDefenderStatus\":\"Unprotected\",\"provisioningState\":\"pqlpq\"},\"location\":\"ciuqgbdb\",\"tags\":{\"mhykojoxafnndl\":\"uvfbtkuwh\",\"kkpwdreqnovvq\":\"ichkoymkcdyhb\",\"syrsndsytgadgvra\":\"ovljxywsu\",\"uu\":\"aeneqnzarrwl\"},\"id\":\"jfqka\",\"name\":\"e\",\"type\":\"iipfpubj\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - AzureArcDataManager manager = AzureArcDataManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.sqlServerInstances().listByResourceGroup("ysmocmbqfqvmkcxo", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ciuqgbdb", response.iterator().next().location()); - Assertions.assertEquals("uvfbtkuwh", response.iterator().next().tags().get("mhykojoxafnndl")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, response.iterator().next().properties().version()); - Assertions.assertEquals(EditionType.WEB, response.iterator().next().properties().edition()); - Assertions.assertEquals("lxprglyatddckcbc", response.iterator().next().properties().containerResourceId()); - Assertions.assertEquals("qrhzoymibmrqyib", response.iterator().next().properties().vCore()); - Assertions.assertEquals(ConnectionStatus.UNKNOWN, response.iterator().next().properties().status()); - Assertions.assertEquals("fluszdtm", response.iterator().next().properties().patchLevel()); - Assertions.assertEquals("kwofyyvoq", response.iterator().next().properties().collation()); - Assertions.assertEquals("piexpbtgiw", response.iterator().next().properties().currentVersion()); - Assertions.assertEquals("oenwashr", response.iterator().next().properties().instanceName()); - Assertions.assertEquals("tkcnqxwb", response.iterator().next().properties().tcpDynamicPorts()); - Assertions.assertEquals("kulpiujwaasi", response.iterator().next().properties().tcpStaticPorts()); - Assertions.assertEquals("i", response.iterator().next().properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.HADR, response.iterator().next().properties().licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-07T23:06:40Z"), - response.iterator().next().properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNPROTECTED, - response.iterator().next().properties().azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java deleted file mode 100644 index 3a41257fdba9..000000000000 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesListMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.azurearcdata.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; -import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType; -import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus; -import com.azure.resourcemanager.azurearcdata.models.DefenderStatus; -import com.azure.resourcemanager.azurearcdata.models.EditionType; -import com.azure.resourcemanager.azurearcdata.models.SqlServerInstance; -import com.azure.resourcemanager.azurearcdata.models.SqlVersion; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class SqlServerInstancesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"version\":\"SQL Server 2019\",\"edition\":\"Express\",\"containerResourceId\":\"pfuflrw\",\"createTime\":\"hdlxyjrxsagafcn\",\"vCore\":\"gwq\",\"status\":\"Unknown\",\"patchLevel\":\"edgfbcvkcvq\",\"collation\":\"keqdcvdrhvoods\",\"currentVersion\":\"bobzdopcjwvnhd\",\"instanceName\":\"wmgxcxrsl\",\"tcpDynamicPorts\":\"utwu\",\"tcpStaticPorts\":\"grpkhjwniyqs\",\"productId\":\"i\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-10-15T20:11:18Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"lvmbmpaxmodfvuef\"},\"location\":\"sbpfvmwyhr\",\"tags\":{\"yzvqt\":\"yftaakcpw\",\"zksmondj\":\"nubexk\"},\"id\":\"quxvypomgkop\",\"name\":\"whojvp\",\"type\":\"jqg\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - AzureArcDataManager manager = AzureArcDataManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.sqlServerInstances().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("sbpfvmwyhr", response.iterator().next().location()); - Assertions.assertEquals("yftaakcpw", response.iterator().next().tags().get("yzvqt")); - Assertions.assertEquals(SqlVersion.SQL_SERVER_2019, response.iterator().next().properties().version()); - Assertions.assertEquals(EditionType.EXPRESS, response.iterator().next().properties().edition()); - Assertions.assertEquals("pfuflrw", response.iterator().next().properties().containerResourceId()); - Assertions.assertEquals("gwq", response.iterator().next().properties().vCore()); - Assertions.assertEquals(ConnectionStatus.UNKNOWN, response.iterator().next().properties().status()); - Assertions.assertEquals("edgfbcvkcvq", response.iterator().next().properties().patchLevel()); - Assertions.assertEquals("keqdcvdrhvoods", response.iterator().next().properties().collation()); - Assertions.assertEquals("bobzdopcjwvnhd", response.iterator().next().properties().currentVersion()); - Assertions.assertEquals("wmgxcxrsl", response.iterator().next().properties().instanceName()); - Assertions.assertEquals("utwu", response.iterator().next().properties().tcpDynamicPorts()); - Assertions.assertEquals("grpkhjwniyqs", response.iterator().next().properties().tcpStaticPorts()); - Assertions.assertEquals("i", response.iterator().next().properties().productId()); - Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, - response.iterator().next().properties().licenseType()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-15T20:11:18Z"), - response.iterator().next().properties().azureDefenderStatusLastUpdated()); - Assertions.assertEquals(DefenderStatus.UNKNOWN, response.iterator().next().properties().azureDefenderStatus()); - } -} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticeAssessmentMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticeAssessmentMockTests.java new file mode 100644 index 000000000000..e46b375241fa --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticeAssessmentMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunBestPracticesAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesRunBestPracticeAssessmentMockTests { + @Test + public void testRunBestPracticeAssessment() throws Exception { + String responseStr + = "{\"id\":\"iriuxegthortu\",\"instanceName\":\"wlpjfelqerppt\",\"jobStatus\":\"InProgress\",\"jobException\":\"nzmnhiilia\",\"backgroundJob\":{\"state\":\"Enabled\",\"executionState\":\"Waiting\",\"startTime\":\"2021-05-03T03:54:28Z\",\"endTime\":\"2021-07-17T05:36:31Z\",\"lastExecutionStatus\":\"Postponed\",\"lastExecutionTime\":\"2020-12-30T16:06:38Z\",\"nextExecutionTime\":\"2021-11-04T10:33:27Z\"},\"sequencerActions\":[{\"actionId\":\"nyuffat\",\"state\":\"CreatingSuccessors\",\"result\":\"Succeeded\"},{\"actionId\":\"wcxbyubhiqdxyurn\",\"state\":\"CreatingSuccessors\",\"result\":\"Succeeded\"},{\"actionId\":\"fccnuhiigb\",\"state\":\"NotStarted\",\"result\":\"Skipped\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceRunBestPracticesAssessmentResponse response = manager.sqlServerInstances() + .runBestPracticeAssessment("jofqcvovjufycs", "mlbemy", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("iriuxegthortu", response.id()); + Assertions.assertEquals("wlpjfelqerppt", response.instanceName()); + Assertions.assertEquals(JobStatus.IN_PROGRESS, response.jobStatus()); + Assertions.assertEquals("nzmnhiilia", response.jobException()); + Assertions.assertEquals(State.ENABLED, response.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, response.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T03:54:28Z"), response.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-17T05:36:31Z"), response.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.POSTPONED, response.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-30T16:06:38Z"), + response.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T10:33:27Z"), + response.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("nyuffat", response.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.CREATING_SUCCESSORS, response.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.SUCCEEDED, response.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticesAssessmentWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticesAssessmentWithResponseMockTests.java new file mode 100644 index 000000000000..0a7491ab8b1f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunBestPracticesAssessmentWithResponseMockTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunBestPracticesAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesRunBestPracticesAssessmentWithResponseMockTests { + @Test + public void testRunBestPracticesAssessmentWithResponse() throws Exception { + String responseStr + = "{\"id\":\"bnoit\",\"instanceName\":\"pz\",\"jobStatus\":\"Failed\",\"jobException\":\"gxvcoqrasw\",\"backgroundJob\":{\"state\":\"Completed\",\"executionState\":\"Waiting\",\"startTime\":\"2020-12-22T23:12:44Z\",\"endTime\":\"2021-05-03T14:43:16Z\",\"lastExecutionStatus\":\"Succeeded\",\"lastExecutionTime\":\"2021-05-11T13:05:57Z\",\"nextExecutionTime\":\"2021-06-11T09:34:37Z\"},\"sequencerActions\":[{\"actionId\":\"hzacaqtyltco\",\"state\":\"WaitingPredecessors\",\"result\":\"Succeeded\"},{\"actionId\":\"sxzakuejkm\",\"state\":\"CreatingSuccessors\",\"result\":\"NotCompleted\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceRunBestPracticesAssessmentResponse response = manager.sqlServerInstances() + .runBestPracticesAssessmentWithResponse("ecjujcng", "adyedmzrgjfok", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("bnoit", response.id()); + Assertions.assertEquals("pz", response.instanceName()); + Assertions.assertEquals(JobStatus.FAILED, response.jobStatus()); + Assertions.assertEquals("gxvcoqrasw", response.jobException()); + Assertions.assertEquals(State.COMPLETED, response.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, response.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-22T23:12:44Z"), response.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T14:43:16Z"), response.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.SUCCEEDED, response.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-11T13:05:57Z"), + response.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-11T09:34:37Z"), + response.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("hzacaqtyltco", response.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.WAITING_PREDECESSORS, response.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.SUCCEEDED, response.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunManagedInstanceLinkAssessmentMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunManagedInstanceLinkAssessmentMockTests.java new file mode 100644 index 000000000000..009c8f360b1d --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunManagedInstanceLinkAssessmentMockTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.AssessmentStatus; +import com.azure.resourcemanager.azurearcdata.models.AzureManagedInstanceRole; +import com.azure.resourcemanager.azurearcdata.models.MiLinkAssessmentCategory; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceManagedInstanceLinkAssessmentResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesRunManagedInstanceLinkAssessmentMockTests { + @Test + public void testRunManagedInstanceLinkAssessment() throws Exception { + String responseStr + = "{\"assessments\":[{\"name\":\"ndscxmxeatk\",\"category\":\"MiToBoxNetworkConnectivity\",\"status\":\"Warning\",\"information\":\"djyibqbnaomhjrm\",\"additionalInformation\":\"hmaxljalfi\",\"failingDbs\":[\"mobcan\",\"de\"]},{\"name\":\"qcwgaxfgvaknokz\",\"category\":\"MiToBoxNetworkConnectivity\",\"status\":\"Warning\",\"information\":\"tixldzyyfytpqs\",\"additionalInformation\":\"ymmpujivy\",\"failingDbs\":[\"juvsmbmslzoyovw\",\"dbpqvybefgvm\"]},{\"name\":\"okcvtlubses\",\"category\":\"ManagedInstanceDatabase\",\"status\":\"Failure\",\"information\":\"t\",\"additionalInformation\":\"unlpirykycndz\",\"failingDbs\":[\"vjreuykbbmnw\",\"gltbxoeeo\"]},{\"name\":\"lnf\",\"category\":\"SqlInstance\",\"status\":\"Success\",\"information\":\"qdbpbhfckdvezc\",\"additionalInformation\":\"ssbzhddubbnqfbl\",\"failingDbs\":[\"lehpavawu\",\"iqjtiogqgdmin\"]}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceManagedInstanceLinkAssessmentResponse response = manager.sqlServerInstances() + .runManagedInstanceLinkAssessment("p", "blkwqpatvbqs", + new SqlServerInstanceManagedInstanceLinkAssessmentRequest().withAzureManagedInstanceResourceId("tcjb") + .withAzureManagedInstanceRole(AzureManagedInstanceRole.SECONDARY) + .withDatabaseNames(Arrays.asList("vuzqymt")) + .withAvailabilityGroupName("owog") + .withDistributedAvailabilityGroupName("gitsqh") + .withAssessmentCategories(Arrays.asList(MiLinkAssessmentCategory.DAG_CROSS_VALIDATION)) + .withSqlServerIpAddress("cdb"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ndscxmxeatk", response.assessments().get(0).name()); + Assertions.assertEquals(MiLinkAssessmentCategory.MI_TO_BOX_NETWORK_CONNECTIVITY, + response.assessments().get(0).category()); + Assertions.assertEquals(AssessmentStatus.WARNING, response.assessments().get(0).status()); + Assertions.assertEquals("djyibqbnaomhjrm", response.assessments().get(0).information()); + Assertions.assertEquals("hmaxljalfi", response.assessments().get(0).additionalInformation()); + Assertions.assertEquals("mobcan", response.assessments().get(0).failingDbs().get(0)); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentWithResponseMockTests.java new file mode 100644 index 000000000000..69ba4007dde5 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationAssessmentWithResponseMockTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesRunMigrationAssessmentWithResponseMockTests { + @Test + public void testRunMigrationAssessmentWithResponse() throws Exception { + String responseStr + = "{\"id\":\"wfbzkkdt\",\"instanceName\":\"qsyclj\",\"jobStatus\":\"Succeeded\",\"jobException\":\"kpbafvafhl\",\"backgroundJob\":{\"state\":\"Active\",\"executionState\":\"Running\",\"startTime\":\"2021-06-17T13:07:28Z\",\"endTime\":\"2021-04-11T15:33:51Z\",\"lastExecutionStatus\":\"Completed\",\"lastExecutionTime\":\"2021-04-26T00:44:43Z\",\"nextExecutionTime\":\"2021-04-07T16:59:09Z\"},\"sequencerActions\":[{\"actionId\":\"fplt\",\"state\":\"CreatingSuccessors\",\"result\":\"Succeeded\"},{\"actionId\":\"rhvhfnracwnpqigt\",\"state\":\"NotStarted\",\"result\":\"Skipped\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceRunMigrationAssessmentResponse response = manager.sqlServerInstances() + .runMigrationAssessmentWithResponse("tzlexbs", "ledynojpz", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("wfbzkkdt", response.id()); + Assertions.assertEquals("qsyclj", response.instanceName()); + Assertions.assertEquals(JobStatus.SUCCEEDED, response.jobStatus()); + Assertions.assertEquals("kpbafvafhl", response.jobException()); + Assertions.assertEquals(State.ACTIVE, response.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.RUNNING, response.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T13:07:28Z"), response.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-11T15:33:51Z"), response.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.COMPLETED, response.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-26T00:44:43Z"), + response.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-07T16:59:09Z"), + response.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("fplt", response.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.CREATING_SUCCESSORS, response.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.SUCCEEDED, response.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationReadinessAssessmentMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationReadinessAssessmentMockTests.java new file mode 100644 index 000000000000..87e96dd51e4b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunMigrationReadinessAssessmentMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ExecutionState; +import com.azure.resourcemanager.azurearcdata.models.JobStatus; +import com.azure.resourcemanager.azurearcdata.models.LastExecutionStatus; +import com.azure.resourcemanager.azurearcdata.models.Result; +import com.azure.resourcemanager.azurearcdata.models.SequencerState; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunMigrationReadinessAssessmentResponse; +import com.azure.resourcemanager.azurearcdata.models.State; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesRunMigrationReadinessAssessmentMockTests { + @Test + public void testRunMigrationReadinessAssessment() throws Exception { + String responseStr + = "{\"id\":\"qxvhcsyhzlwxa\",\"instanceName\":\"ov\",\"jobStatus\":\"InProgress\",\"jobException\":\"dndsbdweade\",\"backgroundJob\":{\"state\":\"Active\",\"executionState\":\"Waiting\",\"startTime\":\"2021-09-30T14:28:46Z\",\"endTime\":\"2021-06-07T19:00:04Z\",\"lastExecutionStatus\":\"Rescheduled\",\"lastExecutionTime\":\"2021-03-24T23:59:50Z\",\"nextExecutionTime\":\"2021-03-24T23:25Z\"},\"sequencerActions\":[{\"actionId\":\"aqylkjztji\",\"state\":\"ExecutingAction\",\"result\":\"Failed\"},{\"actionId\":\"mxitpfinzcpd\",\"state\":\"CreatingSuccessors\",\"result\":\"Failed\"},{\"actionId\":\"jmtbd\",\"state\":\"ExecutingAction\",\"result\":\"TimedOut\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceRunMigrationReadinessAssessmentResponse response = manager.sqlServerInstances() + .runMigrationReadinessAssessment("gvxvatv", "rkdlb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qxvhcsyhzlwxa", response.id()); + Assertions.assertEquals("ov", response.instanceName()); + Assertions.assertEquals(JobStatus.IN_PROGRESS, response.jobStatus()); + Assertions.assertEquals("dndsbdweade", response.jobException()); + Assertions.assertEquals(State.ACTIVE, response.backgroundJob().state()); + Assertions.assertEquals(ExecutionState.WAITING, response.backgroundJob().executionState()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T14:28:46Z"), response.backgroundJob().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-07T19:00:04Z"), response.backgroundJob().endTime()); + Assertions.assertEquals(LastExecutionStatus.RESCHEDULED, response.backgroundJob().lastExecutionStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-24T23:59:50Z"), + response.backgroundJob().lastExecutionTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-24T23:25Z"), + response.backgroundJob().nextExecutionTime()); + Assertions.assertEquals("aqylkjztji", response.sequencerActions().get(0).actionId()); + Assertions.assertEquals(SequencerState.EXECUTING_ACTION, response.sequencerActions().get(0).state()); + Assertions.assertEquals(Result.FAILED, response.sequencerActions().get(0).result()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunTargetRecommendationJobMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunTargetRecommendationJobMockTests.java new file mode 100644 index 000000000000..e5e2ede1b250 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerInstancesRunTargetRecommendationJobMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ResourceUpdateMode; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobRequest; +import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceRunTargetRecommendationJobResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerInstancesRunTargetRecommendationJobMockTests { + @Test + public void testRunTargetRecommendationJob() throws Exception { + String responseStr = "{\"jobStatus\":\"Failed\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerInstanceRunTargetRecommendationJobResponse response = manager.sqlServerInstances() + .runTargetRecommendationJob("uhd", "wsigrbjbxsj", + new SqlServerInstanceRunTargetRecommendationJobRequest() + .withResourceUpdateMode(ResourceUpdateMode.SKIP_RESOURCE_UPDATE) + .withIncludeFileLevelRequirements(true) + .withTargetLocation("qkj") + .withPercentile(1865446937) + .withLookbackPeriodInDays(1744586327), + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseInnerTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseInnerTests.java new file mode 100644 index 000000000000..c421a0cd46e3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseInnerTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.fluent.models.SqlServerLicenseInner; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerLicenseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerLicenseInner model = BinaryData.fromString( + "{\"properties\":{\"billingPlan\":\"PAYG\",\"physicalCores\":125606938,\"licenseCategory\":\"Core\",\"activationState\":\"Deactivated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-09-22T22:28:40Z\",\"lastDeactivatedAt\":\"2021-04-08T23:42:27Z\",\"tenantId\":\"bwjscjpahlxveab\"},\"location\":\"xnmwmqtibxyijddt\",\"tags\":{\"kmr\":\"ttadijae\",\"mudqmeq\":\"ieekpndzaa\"},\"id\":\"igpibud\",\"name\":\"wyxebeybpmzz\",\"type\":\"rtffyaqitmh\"}") + .toObject(SqlServerLicenseInner.class); + Assertions.assertEquals("xnmwmqtibxyijddt", model.location()); + Assertions.assertEquals("ttadijae", model.tags().get("kmr")); + Assertions.assertEquals(BillingPlan.PAYG, model.properties().billingPlan()); + Assertions.assertEquals(125606938, model.properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.properties().licenseCategory()); + Assertions.assertEquals(ActivationState.DEACTIVATED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.properties().scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerLicenseInner model = new SqlServerLicenseInner().withLocation("xnmwmqtibxyijddt") + .withTags(mapOf("kmr", "ttadijae", "mudqmeq", "ieekpndzaa")) + .withProperties(new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAYG) + .withPhysicalCores(125606938) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)); + model = BinaryData.fromObject(model).toObject(SqlServerLicenseInner.class); + Assertions.assertEquals("xnmwmqtibxyijddt", model.location()); + Assertions.assertEquals("ttadijae", model.tags().get("kmr")); + Assertions.assertEquals(BillingPlan.PAYG, model.properties().billingPlan()); + Assertions.assertEquals(125606938, model.properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.properties().licenseCategory()); + Assertions.assertEquals(ActivationState.DEACTIVATED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.properties().scopeType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseListResultTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseListResultTests.java new file mode 100644 index 000000000000..63b876b29be3 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseListResultTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.implementation.models.SqlServerLicenseListResult; + +public final class SqlServerLicenseListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerLicenseListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"billingPlan\":\"Paid\",\"physicalCores\":654993570,\"licenseCategory\":\"Core\",\"activationState\":\"Deactivated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-04-11T08:59:31Z\",\"lastDeactivatedAt\":\"2021-06-28T18:00:54Z\",\"tenantId\":\"zozsdbccxjmonfdg\"},\"location\":\"n\",\"tags\":{\"qjctzenkeif\":\"uuwwltv\"},\"id\":\"zhmkdasvflyh\",\"name\":\"xcudchxgsr\",\"type\":\"oldforobw\"},{\"properties\":{\"billingPlan\":\"PAYG\",\"physicalCores\":2116230034,\"licenseCategory\":\"Core\",\"activationState\":\"Deactivated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-07-22T16:55:51Z\",\"lastDeactivatedAt\":\"2021-11-29T09:16:05Z\",\"tenantId\":\"vacqpbtuodxesz\"},\"location\":\"belawumuaslzkwr\",\"tags\":{\"hnomdrkywuh\":\"ycqucwyh\",\"lniexz\":\"svfuurutlwexxwl\"},\"id\":\"rzpgep\",\"name\":\"tybbwwpgda\",\"type\":\"chzyvlixqnrk\"}],\"nextLink\":\"kjibnxmysuxswqrn\"}") + .toObject(SqlServerLicenseListResult.class); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensePropertiesTests.java new file mode 100644 index 000000000000..139a41a8445b --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensePropertiesTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerLicensePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerLicenseProperties model = BinaryData.fromString( + "{\"billingPlan\":\"Paid\",\"physicalCores\":2070273201,\"licenseCategory\":\"Core\",\"activationState\":\"Deactivated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-04-12T16:42:18Z\",\"lastDeactivatedAt\":\"2021-10-28T08:21:33Z\",\"tenantId\":\"ufuqyrx\"}") + .toObject(SqlServerLicenseProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(2070273201, model.physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.licenseCategory()); + Assertions.assertEquals(ActivationState.DEACTIVATED, model.activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerLicenseProperties model = new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(2070273201) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION); + model = BinaryData.fromObject(model).toObject(SqlServerLicenseProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(2070273201, model.physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.licenseCategory()); + Assertions.assertEquals(ActivationState.DEACTIVATED, model.activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseUpdatePropertiesTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseUpdatePropertiesTests.java new file mode 100644 index 000000000000..e1283a27bcbc --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseUpdatePropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdateProperties; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerLicenseUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerLicenseUpdateProperties model = BinaryData.fromString( + "{\"billingPlan\":\"Paid\",\"physicalCores\":1417294849,\"licenseCategory\":\"Core\",\"activationState\":\"Activated\",\"scopeType\":\"ResourceGroup\",\"lastActivatedAt\":\"2021-08-24T02:38:59Z\",\"lastDeactivatedAt\":\"2021-04-02T13:13Z\",\"tenantId\":\"vuanashcxlp\"}") + .toObject(SqlServerLicenseUpdateProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(1417294849, model.physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.licenseCategory()); + Assertions.assertEquals(ActivationState.ACTIVATED, model.activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerLicenseUpdateProperties model + = new SqlServerLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(1417294849) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.ACTIVATED) + .withScopeType(ScopeType.RESOURCE_GROUP); + model = BinaryData.fromObject(model).toObject(SqlServerLicenseUpdateProperties.class); + Assertions.assertEquals(BillingPlan.PAID, model.billingPlan()); + Assertions.assertEquals(1417294849, model.physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.licenseCategory()); + Assertions.assertEquals(ActivationState.ACTIVATED, model.activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, model.scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseUpdateTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseUpdateTests.java new file mode 100644 index 000000000000..e29d73a234b4 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicenseUpdateTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdate; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseUpdateProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerLicenseUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerLicenseUpdate model = BinaryData.fromString( + "{\"tags\":{\"sismjqfrddga\":\"cgq\",\"disyirnxz\":\"quhiosrsjuivf\",\"revkhgnlnzo\":\"czexrxzbujrtrhqv\"},\"properties\":{\"billingPlan\":\"Paid\",\"physicalCores\":155304322,\"licenseCategory\":\"Core\",\"activationState\":\"Activated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-05-30T03:29:47Z\",\"lastDeactivatedAt\":\"2021-08-02T13:28:26Z\",\"tenantId\":\"ofizehtdhgbj\"}}") + .toObject(SqlServerLicenseUpdate.class); + Assertions.assertEquals("cgq", model.tags().get("sismjqfrddga")); + Assertions.assertEquals(BillingPlan.PAID, model.properties().billingPlan()); + Assertions.assertEquals(155304322, model.properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.properties().licenseCategory()); + Assertions.assertEquals(ActivationState.ACTIVATED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.properties().scopeType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerLicenseUpdate model = new SqlServerLicenseUpdate() + .withTags(mapOf("sismjqfrddga", "cgq", "disyirnxz", "quhiosrsjuivf", "revkhgnlnzo", "czexrxzbujrtrhqv")) + .withProperties(new SqlServerLicenseUpdateProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(155304322) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.ACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)); + model = BinaryData.fromObject(model).toObject(SqlServerLicenseUpdate.class); + Assertions.assertEquals("cgq", model.tags().get("sismjqfrddga")); + Assertions.assertEquals(BillingPlan.PAID, model.properties().billingPlan()); + Assertions.assertEquals(155304322, model.properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, model.properties().licenseCategory()); + Assertions.assertEquals(ActivationState.ACTIVATED, model.properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, model.properties().scopeType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateWithResponseMockTests.java new file mode 100644 index 000000000000..94dde80d2f7e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesCreateWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicenseProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerLicensesCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"billingPlan\":\"PAYG\",\"physicalCores\":1780634429,\"licenseCategory\":\"Core\",\"activationState\":\"Deactivated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-08-04T14:51:07Z\",\"lastDeactivatedAt\":\"2021-11-07T03:35:34Z\",\"tenantId\":\"wwgilfjqqacdm\"},\"location\":\"wxdcvjwcyz\",\"tags\":{\"uicdsiwdfmmpzhzz\":\"eciqchxr\",\"x\":\"vywrgyngydgr\",\"djrkclamggl\":\"cakiqao\",\"jdoq\":\"lmf\"},\"id\":\"ykglt\",\"name\":\"gxhqfgqkayejs\",\"type\":\"tlgflwfgz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerLicense response = manager.sqlServerLicenses() + .define("ulhmzyq") + .withRegion("jc") + .withExistingResourceGroup("lzoblqwaafr") + .withProperties(new SqlServerLicenseProperties().withBillingPlan(BillingPlan.PAID) + .withPhysicalCores(826879471) + .withLicenseCategory(LicenseCategory.CORE) + .withActivationState(ActivationState.DEACTIVATED) + .withScopeType(ScopeType.SUBSCRIPTION)) + .withTags(mapOf("rpdltbq", "xwmzwdfkbnrz")) + .create(); + + Assertions.assertEquals("wxdcvjwcyz", response.location()); + Assertions.assertEquals("eciqchxr", response.tags().get("uicdsiwdfmmpzhzz")); + Assertions.assertEquals(BillingPlan.PAYG, response.properties().billingPlan()); + Assertions.assertEquals(1780634429, response.properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, response.properties().licenseCategory()); + Assertions.assertEquals(ActivationState.DEACTIVATED, response.properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, response.properties().scopeType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteByResourceGroupWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..25a061da71d2 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerLicensesDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.sqlServerLicenses().deleteByResourceGroupWithResponse("a", "hjym", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupWithResponseMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..0742b7132d0f --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerLicensesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"billingPlan\":\"Paid\",\"physicalCores\":1688756223,\"licenseCategory\":\"Core\",\"activationState\":\"Activated\",\"scopeType\":\"ResourceGroup\",\"lastActivatedAt\":\"2021-08-01T11:26:53Z\",\"lastDeactivatedAt\":\"2021-06-27T01:21:03Z\",\"tenantId\":\"nxzcm\"},\"location\":\"ngxno\",\"tags\":{\"dwhepfwwtjfdoes\":\"tdisnjevhdlmyd\",\"dbckyo\":\"xhmw\",\"jzrbhtmeplv\":\"kxkxhnegk\"},\"id\":\"kaobrl\",\"name\":\"pgsn\",\"type\":\"agnchjhgemuowaky\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SqlServerLicense response = manager.sqlServerLicenses() + .getByResourceGroupWithResponse("pa", "pr", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ngxno", response.location()); + Assertions.assertEquals("tdisnjevhdlmyd", response.tags().get("dwhepfwwtjfdoes")); + Assertions.assertEquals(BillingPlan.PAID, response.properties().billingPlan()); + Assertions.assertEquals(1688756223, response.properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, response.properties().licenseCategory()); + Assertions.assertEquals(ActivationState.ACTIVATED, response.properties().activationState()); + Assertions.assertEquals(ScopeType.RESOURCE_GROUP, response.properties().scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupMockTests.java new file mode 100644 index 000000000000..d66f27773cac --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListByResourceGroupMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerLicensesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"billingPlan\":\"PAYG\",\"physicalCores\":1644102835,\"licenseCategory\":\"Core\",\"activationState\":\"Activated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-06-24T09:16:52Z\",\"lastDeactivatedAt\":\"2021-05-03T17:16:47Z\",\"tenantId\":\"evtf\"},\"location\":\"nlbvgjcodkk\",\"tags\":{\"fqb\":\"iytssikizbc\"},\"id\":\"ntnrgmqsorh\",\"name\":\"ekxgn\",\"type\":\"ykmxcpwzvm\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.sqlServerLicenses().listByResourceGroup("cgqtag", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nlbvgjcodkk", response.iterator().next().location()); + Assertions.assertEquals("iytssikizbc", response.iterator().next().tags().get("fqb")); + Assertions.assertEquals(BillingPlan.PAYG, response.iterator().next().properties().billingPlan()); + Assertions.assertEquals(1644102835, response.iterator().next().properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, response.iterator().next().properties().licenseCategory()); + Assertions.assertEquals(ActivationState.ACTIVATED, response.iterator().next().properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, response.iterator().next().properties().scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListMockTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListMockTests.java new file mode 100644 index 000000000000..6b18ed465f4e --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/SqlServerLicensesListMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurearcdata.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurearcdata.AzureArcDataManager; +import com.azure.resourcemanager.azurearcdata.models.ActivationState; +import com.azure.resourcemanager.azurearcdata.models.BillingPlan; +import com.azure.resourcemanager.azurearcdata.models.LicenseCategory; +import com.azure.resourcemanager.azurearcdata.models.ScopeType; +import com.azure.resourcemanager.azurearcdata.models.SqlServerLicense; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SqlServerLicensesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"billingPlan\":\"PAYG\",\"physicalCores\":1017540709,\"licenseCategory\":\"Core\",\"activationState\":\"Deactivated\",\"scopeType\":\"Subscription\",\"lastActivatedAt\":\"2021-06-21T08:04:43Z\",\"lastDeactivatedAt\":\"2021-09-02T01:05:42Z\",\"tenantId\":\"xlbonc\"},\"location\":\"azqicqchygtv\",\"tags\":{\"qvgx\":\"janepubdpkx\",\"hkxdxuwsaifmc\":\"aodetv\",\"ehgcvkbcknjo\":\"nosbz\"},\"id\":\"gjyy\",\"name\":\"pvelszerqze\",\"type\":\"xoqeintxwalj\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureArcDataManager manager = AzureArcDataManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.sqlServerLicenses().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("azqicqchygtv", response.iterator().next().location()); + Assertions.assertEquals("janepubdpkx", response.iterator().next().tags().get("qvgx")); + Assertions.assertEquals(BillingPlan.PAYG, response.iterator().next().properties().billingPlan()); + Assertions.assertEquals(1017540709, response.iterator().next().properties().physicalCores()); + Assertions.assertEquals(LicenseCategory.CORE, response.iterator().next().properties().licenseCategory()); + Assertions.assertEquals(ActivationState.DEACTIVATED, response.iterator().next().properties().activationState()); + Assertions.assertEquals(ScopeType.SUBSCRIPTION, response.iterator().next().properties().scopeType()); + } +} diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java index b455c79c8eb1..0a356ba735e8 100644 --- a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/src/test/java/com/azure/resourcemanager/azurearcdata/generated/UploadWatermarkTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.azurearcdata.generated; @@ -13,21 +13,21 @@ public final class UploadWatermarkTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { UploadWatermark model = BinaryData.fromString( - "{\"metrics\":\"2021-03-12T03:03:28Z\",\"logs\":\"2021-11-01T16:23:57Z\",\"usages\":\"2021-01-30T14:58:59Z\"}") + "{\"metrics\":\"2021-05-29T10:06:01Z\",\"logs\":\"2021-11-13T02:11:34Z\",\"usages\":\"2021-08-13T13:55:16Z\"}") .toObject(UploadWatermark.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T03:03:28Z"), model.metrics()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-01T16:23:57Z"), model.logs()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-30T14:58:59Z"), model.usages()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-29T10:06:01Z"), model.metrics()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T02:11:34Z"), model.logs()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-13T13:55:16Z"), model.usages()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - UploadWatermark model = new UploadWatermark().withMetrics(OffsetDateTime.parse("2021-03-12T03:03:28Z")) - .withLogs(OffsetDateTime.parse("2021-11-01T16:23:57Z")) - .withUsages(OffsetDateTime.parse("2021-01-30T14:58:59Z")); + UploadWatermark model = new UploadWatermark().withMetrics(OffsetDateTime.parse("2021-05-29T10:06:01Z")) + .withLogs(OffsetDateTime.parse("2021-11-13T02:11:34Z")) + .withUsages(OffsetDateTime.parse("2021-08-13T13:55:16Z")); model = BinaryData.fromObject(model).toObject(UploadWatermark.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T03:03:28Z"), model.metrics()); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-01T16:23:57Z"), model.logs()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-30T14:58:59Z"), model.usages()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-29T10:06:01Z"), model.metrics()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T02:11:34Z"), model.logs()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-13T13:55:16Z"), model.usages()); } } diff --git a/sdk/azurearcdata/azure-resourcemanager-azurearcdata/tsp-location.yaml b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/tsp-location.yaml new file mode 100644 index 000000000000..84258aa05317 --- /dev/null +++ b/sdk/azurearcdata/azure-resourcemanager-azurearcdata/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/azurearcdata/AzureArcData.Management +commit: 6160a0aa235ab0b54b42cf3279abbb9a8dce7b97 +repo: Azure/azure-rest-api-specs +additionalDirectories: